Answer the question
In order to leave comments, you need to log in
How to change script to ignore h3 tags?
How to change the script so that it takes into account only li and div equal to it in order?
Live example: jsfiddle.net/4adf4eny Removing h3 will work fine, but they are needed.
(function(s) {
var n;
s(".tabs").on("click", "li:not(.active)", function() {
n = s(this).parents(".tabs_block"), s(this).dmtabs(n)
}), s.fn.dmtabs = function(n) {
s(this).addClass("active").siblings().removeClass("active"), n.find(".box").eq(s(this).index()).show(1, function() {
s(this).addClass("open_tab")
}).siblings(".box").hide(1, function() {
s(this).removeClass("open_tab")
})
}
})(jQuery);
<table class="content tabs_block">
<tbody><tr>
<td class="va-top">
<ul class="tabs">
<li class="active">верх Общая информация</li>
<h3>3Д Фрезерование:</h3>
<li>крупа 3д</li>
<li>3д woods</li>
<h3>3Д Фрезерование:</h3>
<li>2д мир</li>
<h3>3Д Фрезерование:</h3>
<li>низ железо</li>
</ul>
</td>
<td class="va-top">
<div class="box visible">1</div>
<div class="box">2</div>
<div class="box">3</div>
<div class="box">4</div>
<div class="box">5</div>
</td>
</tr></tbody>
</table>
Answer the question
In order to leave comments, you need to log in
(function(s) {
var n;
s(".tabs li").on("click", "li:not(.active)", function() {
n = s(this).parents(".tabs_block"), s(this).dmtabs(n)
}),
s.fn.dmtabs = function(n) {
s(this).addClass("active").siblings().removeClass("active"), n.find(".box").eq(s(this).index()).show(1, function() {
s(this).addClass("open_tab")
}).siblings(".box").hide(1, function() {
s(this).removeClass("open_tab")
})
}
})(jQuery);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question