3

I would like to know which tab is active so I can set it to default until another tab is active then that will be set to default

my problem is that I cant seem to find a way to see which tab is active at the moment and getActiveTab seems to always return the default tab

any help well be greatly appreciated

thanks in advance

3
  • $quicktab = quicktabs_load(5); // enter your QT ID. $quicktab['default_tab'] contains the default tab's ID. – AyeshK Oct 1 '12 at 2:01
  • I cant see how this will work as I dont know the current Active tab unless its possible to put it in js onclick – Sari Oct 1 '12 at 6:57
  • Active tab may possibly have classes attached to it, so you may discover it with Firebug, detect it with jQuery ? Or you may attach your classes on active tabs with jQuery onclick, as you mentioned. – NenadP Oct 1 '12 at 7:44
3

After much consideration and a ton of tries I decided to go with cookies,I added this to my script file from http://drupal.org/node/1454486

Drupal.behaviors.quicktabsHistory = {
attach: function(context, settings) {
  // enable accordion memory
  $('.quick-accordion', context).each(function() {
    var id = $(this).attr('id');
    var accordion = $.cookie(id);

    if (accordion != '') {
      $(this).find('h3 a[href="' + accordion + '"]').click();
    }
    $(this).find('h3 a').click(function() {
      $.cookie(id, $(this).attr('href'));
    });
  });

  // enable tab memory
  $('.quicktabs-wrapper', context).each(function() {
    var id = $(this).attr('id');
    var tab = $.cookie(id);

    if (tab != '') {
      $(this).find('ul.quicktabs-tabs a#' + tab).click();
    }
    $(this).find('ul.quicktabs-tabs a').click(function() {
      $.cookie(id, $(this).attr('id'));
    });
  });
}
};

thanks for your time and efforts

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.