jeudi 26 mars 2015

JQuery open next tab when click on ref


Vote count:

0




here is code:



<ul class="tabs">
<li class="current">First tab</li>
<li>Second tab</li>
</ul>

<div class="box">

<p><a href="ThisPage.php?god='.$param.'">$param</p>
</div>

<div class="box">


Text 1'; } else { echo '

Text 2


'; } ?>

JavaScript:


(function($) { $(function() {



$('ul.tabs').each(function(i) {
var storage = localStorage.getItem('tab'+i);
if (storage) $(this).find('li').eq(storage).addClass('current').siblings().removeClass('current')
.parents('div.section').find('div.box').hide().eq(storage).show();
})

$('ul.tabs').on('click', 'li:not(.current)', function() {
$(this).addClass('current').siblings().removeClass('current')
.parents('div.section').find('div.box').eq($(this).index()).fadeIn(150).siblings('div.box').hide();
var ulIndex = $('ul.tabs').index($(this).parents('ul.tabs'));
localStorage.removeItem('tab'+ulIndex);
localStorage.setItem('tab'+ulIndex, $(this).index());
})


}) })(jQuery) I dont know how to make that when clicked on a link automatically opens the Second tab with Text 1



asked 30 secs ago







JQuery open next tab when click on ref

Aucun commentaire:

Enregistrer un commentaire