javascript - How to link section tabs -
hi need sections i'm using section-container auto deep_linking;true have data-slug each tabs,
i have 3 tabs images on them want have direct link access each individual tabs have link on homepage. tried adding location.hash script, tried .on click , .trigger, , none of them works.
thanks lot.
<body> <div class="section-container auto" data-section="" data-option="deep_linking;true;"> <section class="active"> <p class="title" data-section-title=""><a href="#tab1"></a><span>tab1</span></p> <div class="content" data-slug="loans" data-section-content=""> <h1>tab1</h1></div> <p class="title" data-section-title=""><a href="#tab2"><span>tab2</span></a></p> <div class="content" data-slug="tab2" data-section-content=""> <h1>tab2</h1> </div> </body>
this the simplest way >>>>>> try :
html
<div class="section-container auto" data-section="" data-option="deep_linking;true;"> <section class="active"> <p class="title" data-section-title=""><a id="tab1" href="#tab1"><span>tab1</span></a> </p> <div class="content" data-slug="loans" data-section-content="" id="panel1"> <h1>tab1</h1></div> <p class="title" data-section-title=""><a id="tab2" href="#tab2"><span>tab2</span></a></p> <div class="content" data-slug="tab2" data-section-content="" id="panel2"> <h1>tab2</h1> </div>
jquery
$(document).ready(function (){ $('#panel1').hide(); $('#panel2').hide(); $('#tab1').click(function(){ $('#panel1').show(); $('#panel2').hide(); }); $('#tab2').click(function(){ $('#panel2').show(); $('#panel1').hide(); }); });
demo : here
Comments
Post a Comment