javascript - How do I go back to the previous tab only when I hit back or click on the link the brings me back to the page? -
i have page. page has tabs. 1 of tabs (lets call tab 4) has links opens other pages (and takes away page tabs). secondary page has link on when clicked brings tabbed page on tab last left off on (tab 4). if hit button also. issue is, each time initialize page (i.e. visit page first time in day, or visit page later on (without hitting or "previous page" link, end remaining on last tab on when last visited page (tab 4). can tell me add , when type url in @ later time default me tab 1 (but go tab 4 if hit or previous page link).
basically want state refresh if visit page @ later time not refresh if hit or "click previous page". how set expiry date local storage (i.e. instance on connecting page) here code.
<script> jquery('#lmd_create_tabs > ul li').click(function(e) { var = jquery(this).prevall().length; localstorage.activetab = i; }); jquery(function() { var myactivetab if (typeof localstorage.activetab !== 'undefined') { myactivetab = localstorage.activetab; } jquery('#lmd_create_tabs > ul > li:eq('+myactivetab+')').trigger('click'); }); jquery(function() { // capture click event jquery('#lmd_create_tabs > ul li').click(function(e) { var = jquery(this).prevall().length; localstorage.activetab = i; }); var myactivetab = 0; if (typeof localstorage.activetab !== 'undefined') { myactivetab = localstorage.activetab; } jquery('#lmd_create_tabs > ul > li:eq('+myactivetab+')').trigger('click'); }); </script>
Comments
Post a Comment