Support » Plugins » [Plugin: Section Widget] Keep same tab when switching pages

Viewing 4 replies - 1 through 4 (of 4 total)
  • You might want to check this out: http://jqueryui.com/demos/tabs/#option-cookie (Warning: JavaScript/jQuery ahead..)

    I think you refer to this code element as the solution, yes?
    http://jqueryui.com/demos/tabs/#…immediately_select_a_just_added_tab

    in which case, we stick that code within the plugin source code as instructed there?

    I worked out, with help of my own site reader, that this is the code to insert. I’m not sure into which file to put it into?

    var $tabs = $('#example').tabs();
    var selected = $tabs.tabs('option', 'selected'); // => 0

    Hi, what you want to do is actually kind of complicated. In order to make a tab “stay selected” between different pages, you’d have to store that value somewhere in a browser cookie. The example you linked from above is for a different task, and the code you pasted in your last post is for reading the current selected tab’s ID, but it doesn’t store it anywhere or use it in any meaningful way.

    To do what you need, you’ll need to load jquery.cookies.js (Download it from here). And then you can add the following code in your theme JavaScript file:

    jQuery('.swt-wrapper').tabs('option', 'cookie', { expires: 30 });

    If you are not too comfortable with doing all that, I’d advise you to leave it as is unless the feature is mission critical to your site.

    Godfrey

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Section Widget] Keep same tab when switching pages’ is closed to new replies.