Menu icon Foundation
Foundation tabs when I refresh

Hello everyone,

For a project, i have added 3 tabs and i want to stay on the current tab when I refresh the page.
Is that possible ?

Thanks for your aswer !

(and sorry for my english, i'm french..)

tabrefresh

Hello everyone,

For a project, i have added 3 tabs and i want to stay on the current tab when I refresh the page.
Is that possible ?

Thanks for your aswer !

(and sorry for my english, i'm french..)

This post has been closed. No new replies can be added.

Alexander Assimidis over 5 years ago

Then u have to work with cookies so it does it for each user differnt

Lucas Barbay over 5 years ago

And how I use cookies ?

Lucas Barbay over 5 years ago

Someone ?

Lucas Barbay about 5 years ago

Finally i found a solution :
```Javascript

$(document).foundation({
tab: {
callback : function (tab) {
var pan = String(tab.context).split("#"); //récupère le nom du panel
document.cookie="panel="+pan[1]; //injecte le nom du panel dans les cookies
console.log(tab.context);
}
}
});

  $(document).ready(function() {

    //alert(str);
    if (getCookie("panel") != "") {
      $('#panel2-1').removeClass('active');
      $('#panel2-1a').removeClass('active');
      $('#'+getCookie("panel")).addClass('active');
      $('#'+getCookie("panel")+'a').addClass('active');
    }        
  });
</script>