Select a Quicktabs default tab from the URL

By shane
Thu, 2011-08-04 10:51

Share with Others

If you have used the Quicktabs module, you know it is an easy way to displayed tabbed content on a Drupal site. However, I ran into the situation where I wanted to load a different default tab on a page. Quicktabs allows you to select the default tab to load, however in some circumstances it may be necessary to load a different tab by default (if a user is coming from another place on the site).

As a quick example of how this might be useful, assume you have an e-commerce site that uses Quicktabs to display product information in one tab, and customer reviews in another tab. There are times when it might be useful to take a user directly from a link to the customer reviews tab instead of loading the default product information tab.

It turns out that this is actually really simple to do. I felt like I should post this information because I spent much longer then necessary looking for how to get an alternative default Quicktabs tab to load, and it was right in front of my face the entire time.

If you want to find the link to load a different tab, just hover over the tab and instead of just clicking on the tab, copy the link of that tab. You will notice that the link has an argument appended on the end that looks something like:


Note: The # sign and anything after that in the argument above is not actually required.

This tells Quicktabs to load the second tab (Quicktabs starts counting at 0) in the third Quicktab block that you have created (a Quicktabs ID of 3). All you need to do is place this URL argument on the end of any link that you want to load the alternative tab as the default and your done. This is so incredibly simple, but if you are like me, it may be something you overlook.