Direct Link to a Quick Tab

jamsaul - June 3, 2008 - 21:00
Project:Quick Tabs
Version:5.x-1.3
Component:User interface
Category:task
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

Is there a way for me to create a direct link to a Quick Tab? Say I have a contact page with two tabs - one contains address/gmaps info and the other is a contact form. If I want to send an e-mail to someone that brings them directly to the contact form's tab is that possible?

The same method would be used for individual tabs linked from the main menu drop-downs.

#1

txcrew - June 26, 2008 - 13:02
Version:5.x-1.x-dev» 5.x-1.3

I have a similar situation. I want to link from another section on my site to a specific QT.

Any help would be greatly appreciated.

txcrew

#2

kmasters - August 7, 2008 - 17:19

Has anybody found a solution to this?

Thanks!

Kevin.

#3

aaustin - September 18, 2008 - 14:12

I just posted a possible fix for the Drupal 6 version.

I am not using this with Drupal 5 but would imagine the fix might be transferable.

http://drupal.org/node/308633

#4

katbailey - September 19, 2008 - 18:35

#5

Pasqualle - December 8, 2008 - 03:10
Status:active» duplicate

#308633: direct url to a tab

#6

rigoy22k - December 31, 2008 - 14:05

I can't use aaustin's solution on d5. But i made few modifications only on quicktabs.js to make Direct Link to a Quick Tab,

So this is quicktabs.js on ../js/ in quicktabs module

Drupal.quicktabs = function() {
var indexPagina = gup('qt_active');
$('div.quicktabs').hide();
$('div.quicktabs:eq('+indexPagina+')').show();
$('ul.quicktabs_tabs li:eq('+indexPagina+')').addClass('active');
var effect = Drupal.settings.quicktabs.effect;
var clickFunction = function() {
var tabIndex = this.myTabIndex;
$(this).parents('div.quicktabs_wrapper').find('div.quicktabs').hide();
$(this).parents('li').siblings().removeClass('active');
$(this).parents('li').addClass('active');
switch (effect) {
case 'none':
$(this).parents('div.quicktabs_wrapper').find('div.quicktabs:eq('+tabIndex+')').show();
break;
case 'fade':
$(this).parents('div.quicktabs_wrapper').find('div.quicktabs:eq('+tabIndex+')').fadeIn();
break;
case 'slide':
$(this).parents('div.quicktabs_wrapper').find('div.quicktabs:eq('+tabIndex+')').slideDown('slow');
break;
}

return false;
};
$('ul.quicktabs_tabs').each(function(){
var i = 0;
$(this).find('li a').each(function() {
this.myTabIndex = i++;
});
});
$('ul.quicktabs_tabs li a').bind('click', clickFunction);
}

if (Drupal.jsEnabled) {
$(document).ready(Drupal.quicktabs);
}

function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}

// $Id: quicktabs.module,v 1.6.2.17
(the solution its functional but i'm not js programmer, if anyone can check this, will be very appreciate for me :D )

using this:
http://www.Yourdrupalsite/Yournode?qt_active=Number of the tab.

#7

druryjeff - February 24, 2009 - 21:25

thanks for the mod, rigoy22k. this worked as advertised. however, i had to add a few mods to get it to work for my specific situation:

if you try to access the page containing the tabs without passing the "qt_active" string (using your example url above, http://www.Yourdrupalsite/Yournode), none of the tabs get populated.

the original quicktabs.js has a line to populate the initial tab - $('div.quicktabs:first-child').show(); - but this line is omitted in your code in favor of a function call that passes the query string to pick the desired tab ($('div.quicktabs:eq('+indexPagina+')').show();).

to remedy this, i simply added a conditional statement that checks if the value of indexPagina is empty (indicating the default, no query string added, status); if this is true, i execute the original code - $('div.quicktabs:first-child').show(); - otherwise, i execute your code - $('div.quicktabs:eq('+indexPagina+')').show();:

  if(indexPagina==''){
    $('div.quicktabs:first-child').show();
  } else {
    $('div.quicktabs:eq('+indexPagina+')').show();
  }

i hope this helps someone.

#8

rigoy22k - March 10, 2009 - 15:14

You right! Thanks you a lot!.
Work Perfectly.

#9

tchopshop - October 29, 2009 - 00:29

Unfortunately, this isn't working for me... can you specify where to put the code from #6 and also where to put the addition to the code in #7?

I want to link directly to a tab from a menu item, so I'm putting in full URLs in the menu block...

 
 

Drupal is a registered trademark of Dries Buytaert.