views:

11

answers:

0

I have a jQuery Tabs plugin, i am trying to externalize the parameter taht would define wich tab is selected on page load:

the extend part of the plugin is:

jQuery.fn.tabs = function(settings){
 //configurable options
 var o = $.extend({
  trackState: false, //track tabs in history, url hash, back button, page load
  srcPath: 'jQuery.history.blank.html',
  autoRotate: false,
  alwaysScrollToTop: true
 },settings);

the function i want to externalize it's: selectTabFromHash(null,true):

function selectTabFromHash(hash){
   var currHash = hash || window.location.hash;
   var hashedTab = tabsNav.find('a[href=#'+ currHash.replace('#','') +']');
      if( hashedTab.size() > 0){
       selectTab(hashedTab,true); 
      }
      else {
       selectTab( tabsNav.find('a:first'),true);
      }
      //return true/false
      return !!hashedTab.size();
  }

  //if state tracking is enabled, set up the callback
  if(o.trackState){ $.historyInit(selectTabFromHash, o.srcPath); }


  //set tab from hash at page load, if no tab hash, select first tab
  selectTabFromHash(null,true);

if i put a string with the name of a hash from the tab it works, ex: selectTabFromHash("Movie tab",true); but i need this to be configurable per page, something like:

$('div#tabs').tabs({here goes the hash i selected to have the tab selected on page load}) , i cant find the way how to call the string.