You will recieve your password to this address. Address is not made public.

Your preferred username that is used when logging in.

Please help with jQuery function: Tabs with drop-line sub links Created Jun 7, 2010

This thread is solved

Views: 1243     Replies: 3     Last reply Aug 30, 2010  
You must login first before you can use this feature

catteaumaru

Posts: 3

Registered:
Jun 7, 2010

Please help with jQuery function: Tabs with drop-line sub links

Posted: Jun 7, 2010

Hello,
I am new here and don't have any jQuery programming skills at all. However, I would like to achieve the following. I have some tabs with a drop-line sub links.

What I want is, when clicked, to display the content of the main tab and all the contents of the sub links in the div.css-panes. When a sub link is clicked then to only display the contents of that link in the div.css-panes.

This is my html:

<div class="header">
  <!-- tabs -->
  <ul class="css-tabs">
    <li><a href="#" class="current"><b>Artwork</b>
    <!--[if IE 7]><!--></a><!--<![endif]-->
      <!--[if lte IE 6]><table><tr><td><![endif]-->
      <ul class="sub">
        <li><a href="#nogo"><strong>Sub Artwork 1</strong></a></li>
        <li><a href="#nogo"><strong>Sub Artwork 2</strong></a></li>
      </ul>
      <!--[if lte IE 6]></td></tr></table></a><![endif]-->
    </li>
    <li><a href="#"><b>Covers</b>
    <!--[if IE 7]><!--></a><!--<![endif]-->
      <!--[if lte IE 6]><table><tr><td><![endif]-->
      <ul class="sub">
        <li><a href="#nogo"><strong>Sub Covers 1</strong></a></li>
        <li><a href="#nogo"><strong>Sub Covers 2</strong></a></li>
      </ul>
      <!--[if lte IE 6]></td></tr></table></a><![endif]-->
    </li>
    <li><a href="#"><b>Labels</b>
    <!--[if IE 7]><!--></a><!--<![endif]-->
      <!--[if lte IE 6]><table><tr><td><![endif]-->
      <ul class="sub">
        <li><a href="#nogo"><strong>Sub Labels 1</strong></a></li>
        <li><a href="#nogo"><strong>Sub Labels 2</strong></a></li>
      </ul>
      <!--[if lte IE 6]></td></tr></table></a><![endif]-->
    </li>
  </ul>
  <!-- /tabs -->
</div>
<div class="sub-container"></div>

<!-- tab panes -->
<div class="css-panes">
  <div style="display:block;">Artwork Main Content</div>
  <!-- Begin Sub Content -->
  <div class="sub-panes">Sub Artwork Content 1</div>
  <div class="sub-panes">Sub Artwork Content 2</div>
  <!-- // End Sub Content -->

  <div>Covers Main Content</div>
  <!-- Begin Sub Content -->
  <div class="sub-panes">Sub Covers Content 1</div>
  <div class="sub-panes">Sub Covers Content 2</div>
  <!-- // End Sub Content -->

  <div>Labels Main Content</div>
  <!-- Begin Sub Content -->
  <div class="sub-panes">Sub Labels Content 1</div>
  <div class="sub-panes">Sub Labels Content 2</div>
  <!-- // End Sub Content -->
</div>

And this is the working plugin:

$(function() {
  // :first selector is optional if you have only one tabs on the page
  $("ul.css-tabs").tabs("div.css-panes > div");
});

I tried to post the css as well, but for some reason the system does not allow this.

catteaumaru

Posts: 3

Registered:
Jun 7, 2010

» Please help with jQuery function: Tabs with drop-line sub links

Posted: Jun 18, 2010

Reply to: Please help with jQuery function: Tabs with drop-line sub links, from catteaumaru
This is what I now have as a solution, but it means that I have to duplicate the content. Not the way to go at all.


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <link rel="stylesheet" type="text/css" href="css/tabs_v4.css"/>
 <!-- default set of jQuery Tools + jQuery 1.3.2 -->
 <!-- script type="text/javascript" src="http://cdn.jquerytools.org/1.1.2/jquery.tools.min.js"></script -->
 <script type="text/javascript" src="js/jquery.tools.min.js"></script>
 <title>tabbedContent_v5</title>
</head>

<body>
<div class="header">
  <!-- tabs -->
  <ul class="css-tabs">
    <li><a href="#" class="current"><b>Artwork</b>
    <!--[if IE 7]><!--></a><!--<![endif]-->
      <!--[if lte IE 6]><table><tr><td><![endif]-->
      <ul class="sub">
        <li><a href="#nogo"><strong>Sub Artwork 1</strong></a></li>
        <li><a href="#nogo"><strong>Sub Artwork 2</strong></a></li>
      </ul>
      <!--[if lte IE 6]></td></tr></table></a><![endif]-->
    </li>
    <li><a href="#"><b>Covers</b>
    <!--[if IE 7]><!--></a><!--<![endif]-->
      <!--[if lte IE 6]><table><tr><td><![endif]-->
      <ul class="sub">
        <li><a href="#nogo"><strong>Sub Covers 1</strong></a></li>
        <li><a href="#nogo"><strong>Sub Covers 2</strong></a></li>
      </ul>
      <!--[if lte IE 6]></td></tr></table></a><![endif]-->
    </li>
    <li><a href="#"><b>Labels</b>
    <!--[if IE 7]><!--></a><!--<![endif]-->
      <!--[if lte IE 6]><table><tr><td><![endif]-->
      <ul class="sub">
        <li><a href="#nogo"><strong>Sub Labels 1</strong></a></li>
        <li><a href="#nogo"><strong>Sub Labels 2</strong></a></li>
      </ul>
      <!--[if lte IE 6]></td></tr></table></a><![endif]-->
    </li>
  </ul>
  <!-- /tabs -->
</div>
<div class="sub-container"></div>

<!-- tab panes -->
<div class="css-panes">
  <div style="display:block;">
    <span style="display:block;">Artwork Main Content</span>
    <!-- Begin Sub Content -->
    <span style="display:block;">Sub Artwork Content 1</span>
    <span style="display:block;">Sub Artwork Content 2</span>
    <!-- // End Sub Content -->
  </div>

  <div>Sub Artwork Content 1</div>
  <div>Sub Artwork Content 2</div>

  <div style="display:block;">
    <span>Covers Main Content</span>
    <!-- Begin Sub Content -->
    <span style="display:block;">Sub Covers Content 1</span>
    <span style="display:block;">Sub Covers Content 2</span>
    <!-- // End Sub Content -->
  </div>

  <div>Sub Covers Content 1</div>
  <div>Sub Covers Content 2</div>

  <div style="display:block;">
    <span>Labels Main Content</span>
    <!-- Begin Sub Content -->
    <span style="display:block;">Sub Labels Content 1</span>
    <span style="display:block;">Sub Labels Content 2</span>
    <!-- // End Sub Content -->
  </div>
  
  <div>Sub Labels Content 1</div>
  <div>Sub Labels Content 2</div>

</div>
	<!-- activate tabs with JavaScript -->
	<script type="text/javascript">
	$(function() {
		$("ul.css-tabs").tabs("div.css-panes > div", {
		  effect: 'fade'
		});
	});

	$(function() {
		// set opacity to nill on page load
		$("ul#menu span").css("opacity","0");
		// on mouse over
		$("ul#menu span").hover(function () {
			// animate opacity to full
			$(this).stop().animate({
				opacity: 1
			}, 'slow');
		},
		// on mouse out
		function () {
			// animate opacity to nill
			$(this).stop().animate({
				opacity: 0
			}, 'slow');
		});
	});

</script>
</body>
</html>

wls

Posts: 6

Registered:
Aug 24, 2010

» Please help with jQuery function: Tabs with drop-line sub links

Posted: Aug 29, 2010

Reply to: Please help with jQuery function: Tabs with drop-line sub links, from catteaumaru
Could we please see your tabs_v4.css as well? Thank you.

catteaumaru

Posts: 3

Registered:
Jun 7, 2010

tabs_v4.css

Posted: Aug 30, 2010

Reply to: » Please help with jQuery function: Tabs with drop-line sub links, from wls
Hello wls,

Thanks for offering to help.


body {
  padding:150px 50px !important;
  background:#020202;
  font:10pt Verdana, Geneva, sans-serif;
  margin:50px 0;
  overflow:hidden;
  color:#C2C2C2;
}

a {
  color:#FFF !important;
  cursor:pointer;
  text-decoration:none;
}

a, a:active {outline:none;}

/* Firefox Dotted Outline Fix
   ******************************************************************************/
a:focus { 
		-moz-outline-style: none; 
}

a:hover {
  text-decoration:none;
}

.header {
	background:#191919 url(../images/bg-header.png) repeat-x;
  padding:0;
  border-left:1px solid #898989;
  border-right:1px solid #898989;
  border-top:1px solid #898989;
  height:42px;
  }
.sub-container {
  background: #1F1F1F;
  height:24px;
  border-left:1px solid #898989;
  border-right:1px solid #898989;
  border-bottom:1px solid #5C5C5C;
  margin-bottom:1px;
}
/* tab pane */
div.css-panes div {
	display:none;
	border:1px solid #898989;
	border-width:0 1px 1px 1px;
	background-color:#282828;
  padding:5px;
  }
  
/* root element for tabs
   ******************************************************************************/
.css-tabs {  
	margin:0 !important; 
	padding:0;
	height:41px;
	border-bottom:1px solid #898989;
  list-style-type:none;
  z-index:500;
  position:relative;
}

/* single tab
   ******************************************************************************/
.css-tabs li {
  display:inline;
	float:left;
  background:url(../images/glassTab_on.png) no-repeat;
  margin-right:22px;
}

/* link inside the tab. uses a background image
   ******************************************************************************/
ul.css-tabs li a { 
	display:block;
	height:41px;
	float:left;
  background:url(../images/glassTab_off.png) no-repeat;
	text-decoration:none;
	font-size:11px;
  letter-spacing:1px;
  line-height:40px;
  text-align:center;
  text-transform:uppercase;
}

.css-tabs li a b {
  margin:0 -22px 0 22px; display:inline; float:left; height:41px; background:url(../images/glassTab_off.png) right top; padding:0 22px 0 0;
	border-right:1px solid #898989;
}

.css-tabs li a:hover {
  border:none; 
  background:#1F1F1F url(../images/glassTab_on.png) no-repeat; cursor:pointer; color:#FFF;
}

/* selected tab
   ******************************************************************************/
.css-tabs li a.current, .css-tabs li a.current:hover {
	background: #1F1F1F url(../images/glassTab_on.png) no-repeat;
	color:#FFF;	
	cursor:default;
	border-bottom:1px solid #1F1F1F;	
}
/* selected tab
   ******************************************************************************/
.css-tabs li a.current b, .css-tabs li a.current:hover b {
	background: #1F1F1F url(../images/glassTab_on.png) right top;
	color:#FFF;	
	cursor:default;
	border-bottom:1px solid #282828;
}
.css-tabs li a:hover b {
	border-bottom:1px solid #898989;
	background: #1F1F1F url(../images/glassTab_on.png) right top;
}
/* Sub tabs styling
   ******************************************************************************/
.css-tabs .sub {
display:none;
}

/* IE6 only
   ******************************************************************************/
.css-tabs table {
border-collapse:collapse; 
margin:-1px; 
font-size:1em; 
width:0; 
height:0;
}

.css-tabs .sub {
margin:0; 
padding:0;
list-style:none;
}
.css-tabs .sub li {
  display:inline;
  float:left;
  margin:0 !important;
}

.css-tabs :hover .sub {
  margin:0;
  padding:0;
  top:41px;
  position:absolute;
  display:block;
  float:left;
  /*
  left:0;
  */
}

.css-tabs :hover .sub li {
   background:none; 
}
.css-tabs :hover .sub li a {
  display:block;
  height:24px; 
  line-height:24px; 
  float:left; 
  background: url(../images/neon-leftUp.png) no-repeat;
  text-decoration:none;
  font-size:9px;
  letter-spacing:1px;
}

.css-tabs :hover .sub li a strong {
  margin:0 0 0 25px;
  display:inline;
  float:left;
  height:24px;
  background:url(../images/neon-rightUp.png) right top;
  padding:0 25px 0 0;
  color:#FFF;
  text-transform:uppercase;
}
.css-tabs :hover .sub li a:hover {
  border:0;
  background-image:url(../images/neon-leftOver.png);
  cursor:pointer;
  color:#FFF;
}

.css-tabs :hover .sub li a:hover strong {
   border:0;
   background-image:url(../images/neon-rightOver.png);
   cursor:pointer;
   color:#FFF;
}

.css-tabs :hover .sub li a.current {
   background-image:url(../images/neon-leftOver.png);
   color:#FFF;
}

.css-tabs :hover .sub li a.current strong {
  background-image:url(../images/neon-rightOver.png);
}
/* End Sub Tabs styling
   ******************************************************************************/