I’ve designed a tab page and followed the instruction from this post: http://alexchizhov.com/pwstabs/
How to stay on current tab when refresh page?
Here is my code:
jQuery(document).ready(function ($) {
$('.tabset0').pwstabs();
$('.tabset1').pwstabs({
effect: 'scale',
defaultTab: 3,
containerWidth: '600px'
});
$('.tabset2').pwstabs({
effect: 'slideleft',
defaultTab: 2,
containerWidth: '600px'
});
$('.tabset3').pwstabs({
effect: 'slidetop',
defaultTab: 3,
containerWidth: '600px'
});
});
<div class="content">
<div class="tabset0">
<div data-pws-tab="tab1" data-pws-tab-name="First Tab">
First tab Content
</div>
<div data-pws-tab="tab2" data-pws-tab-name="Second Tab">
Second tab Content
</div>
<div data-pws-tab="tab3" data-pws-tab-name="Third Tab">
Third tab Content
</div>
</div>
</div>
I would appreciate if anyone can shed some light and help me with this.
You could set a cookie when "opening" a tab, and on page load read the cookie and use PWS's defaultTab setting. Unfortunately PWS doesn't seem to dispatch events when changing tabs, so you will have to bind this to the "tab button".
Using js-cookie, reading the cookie could be something like this: