Documentation:UBC Content Management System/How to/How to link to a tab?

From UBC Wiki
Jump to: navigation, search

Add the following jQuery to each page that requires this function below in the 'Custom JavaScript' section, or in the site's 'Global Theme Option', 'Custom Javascript' section to enable it for the entire site.


//Adds the ability to link to tabs
jQuery(document).ready(function () {
   var activeTab = jQuery('[href=' + location.hash + ']');
   activeTab && activeTab.tab('show');
});

For example, to link to the "Finding Scholarly Research" tab on the 'Scholarly vs. Popular Sources' page, http://help.library.ubc.ca/evaluating-and-citing-sources/scholarly-versus-popular-sources, use this link -

http://help.library.ubc.ca/evaluating-and-citing-sources/scholarly-versus-popular-sources/#fragment-8f9ae4d3dc9293c8c218576a0080e78d-2

See Also

How do I add JavaScript files on each page of my site?