I have tabs above the contents of my tab.
While my tab is long, I duplicate my tabs also under the contents of the tab.
So it looks like this:
[tab 1] [tab 2]
- content
[tab 1] [tab 2]
I am using css and jQuery.
When I change the tab above, the effects of css usually change. but it does not change in the bottom list of tabs.
The same is true for the bottom; when I change the tab at the bottom of the list of tabs, css effects only change at the bottom, but not above the list of tabs.
I want to change them right away because it looks confusing.
HTML:
<div class="tabs">
<ul class="tab-links">
<li class="active"><a href="#tab1">Tab #1</a></li>
<li><a href="#tab2">Tab #2</a></li>
</ul>
<div class="tab-content">
<div id="tab1" class="tab active">#1 content</div>
<div id="tab2" class="tab">#2 content </div>
</div>
<div class="tabs">
<ul class="tab-links">
<li class="active"><a href="#tab1">Tab #1</a></li>
<li><a href="#tab2">Tab #2</a></li>
</ul>
</div>
</div>
JavaScript:
jQuery(document).ready(function() {
jQuery('.tabs .tab-links a').on('click', function(e) {
var currentAttrValue = jQuery(this).attr('href');
jQuery('.tabs ' + currentAttrValue).slideDown(400).siblings().slideUp(400);
jQuery(this).parent('li').addClass('active').siblings().removeClass('active');
e.preventDefault();
});
});
jsFiddle:
http://jsfiddle.net/4m2ut16k/
*
I expected it to work like this because the CSS codes are the same, so if it works in tab-list-above, why not work in tab-list-bottom?