Hi there,
I've made a site with 4 tabs with all kinds of content in them. Now, if a user clicks on an item an gets taken to that page, when he returns by hitting backspace, the same tab he was on should still be active. How do I achieve this? It's only possible with cookies, but I'm not advanced enough to pull this off by myself.
The tabscript:
I guess...Code:$('ul.tabs').each(function(){ var $active, $content, $links = $(this).find('a'); $active = $($links.filter('[href="'+location.hash+'"]')[0] || $links[0]); $active.addClass('active'); $content = $($active.attr('href')); $links.not($active).each(function () { $($(this).attr('href')).hide(); }); $(this).on('click', 'a', function(e){ $active.removeClass('active'); $content.hide(); $active = $(this); $content = $($(this).attr('href')); $active.addClass('active'); $content.show(); e.preventDefault(); }); });
- I need this plugin.
- Add this
after (this)on.click.Code:$.cookie('active_tab', rel);
- Use jquery to point the browser to the active tab?
I'm a bit lost.


Reply With Quote




Bookmarks