Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // JavaScript Document
- (function($) {
- Drupal.behaviors.quicktabsTabMemory = {
- attach: function(context, settings) {
- // The .each() is in case there is more than one quicktab on a page.
- $('.quicktabs-wrapper', context).each(function () {
- var $this = $(this);
- var wrapperID = $this.attr('id');
- var nid = settings.nordtec_klister['currentNid']; // getting the nid on the client side
- var $activeTabLink = $('.quicktabs-tabs li.active a', context);
- var activeTabLinkID = $activeTabLink.attr('id');
- // Use a unique cookie namespace for each set of Quicktabs, which
- // should allow for more than one set on a page.
- var cookieName = 'Drupal-quicktabs-active-tab-id-' + wrapperID + 'nid='+ nid;
- // Default cookie options.
- var cookieOptions = {path: '/'};
- // Click the tab ID if a cookie exists otherwise set a cookie for
- // the default active tab.
- var $cookieValue = $.cookie(cookieName);
- if ($cookieValue) {
- $('#' + $cookieValue).click();
- }
- else {
- $.cookie(cookieName, activeTabLinkID, cookieOptions);
- }
- // Set the click handler for all tabs, this updates the cookie on every
- // tab click.
- $this.find('ul.quicktabs-tabs a').click(function quicktabsCookieClickHandler() {
- $activeTabLink = $this.find('.quicktabs-tabs li.active a', context);
- activeTabLinkID = $activeTabLink.attr('id');
- $.cookie(cookieName, activeTabLinkID, cookieOptions);
- });
- });
- }
- };
- })(jQuery);
- ini_set('session.gc_maxlifetime', 28800);
- ini_set('session.cookie_lifetime', 28800);
Add Comment
Please, Sign In to add comment