Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Have a look at this:-</p> <p>right now i am storing preference in the <code>localstorage</code>.</p> <p><a href="https://developer.mozilla.org/en-US/docs/DOM/Storage" rel="nofollow">See Ref</a> for DOM storage options. But cookie might be a safe option in your case or store it in the server.</p> <p><a href="http://jsfiddle.net/sH23W/" rel="nofollow">Demo</a></p> <h3>storage Logic</h3> <pre><code> if (localStorage.activeTab) {//see if a tab has been stored in the localStorage $('.active').removeClass('active'); $(".tabs li:nth-child(" + (parseInt(localStorage.activeTab, 10) + 1) + ") a.tab").addClass('active'); //Select that tab based on preference. } localStorage.activeTab = $(this).parent().index(); //Store the tab in the storage. </code></pre> <h3>Full Script</h3> <pre><code>$(document).ready(function () { if (localStorage.activeTab) {//see if a tab has been stored in the localStorage $('.active').removeClass('active'); $(".tabs li:nth-child(" + (parseInt(localStorage.activeTab, 10) + 1) + ") a.tab").addClass('active'); //Select that tab based on preference. } // When a link is clicked $("a.tab").click(function () { // switch all tabs off $(".active").removeClass("active"); // switch this tab on $(this).addClass("active"); localStorage.activeTab = $(this).parent().index(); //Store the tab in the storage. // slide all content up $(".content").slideUp(); // slide this content up var content_show = $(this).attr("title"); $("#" + content_show).slideDown(); }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload