Created
December 23, 2013 00:56
-
-
Save cafuego/8090362 to your computer and use it in GitHub Desktop.
Re-open a quicktab after clicking a link under said tab (for a quicktabs view)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
Drupal.qtpersist = Drupal.qtpersist || {}; | |
Drupal.behaviors.qtpersist = { | |
attach: function (context, settings) { | |
$.extend(true, Drupal.settings, settings); | |
$('.quicktabs-wrapper', context).once(function(){ | |
Drupal.qtpersist.prepare(this); | |
}); | |
} | |
} | |
// Setting up the inital behaviours | |
Drupal.qtpersist.prepare = function(el) { | |
// el.id format: "quicktabs-$name" | |
var qt_name = Drupal.quicktabs.getQTName(el); | |
var $main = $(el).find('div.quicktabs_main:first'); | |
$main.find('div.quicktabs-tabpage').each(function(i, element){ | |
element.myTabIndex = i; | |
element.qt_name = qt_name; | |
$(element).find('div.quicktabs-views-group a').each(function() { | |
if (!$(this).hasClass('qtpersist')) { | |
var _href = $(this).attr('href'); | |
$(this).attr('href', _href + '?qt-' + qt_name + '=' + i); | |
$(this).addClass('qtpersist'); | |
} | |
}) | |
}); | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment