User:Locke/common.js: Difference between revisions

Jump to navigation Jump to search
Want an adless experience? Log in or Create an account.
no edit summary
(this isn't good enough, I need to keep track of some object with all the selections for a selector.)
No edit summary
Line 1: Line 1:
var tabstate = {};
$('.tabset').each( function() {
$('.tabset').each( function() {
   var target = $(this).attr('tab-target');
   var target = $(this).attr('tab-target');
   var selector = $(this).attr('tab-selector');
   var selector = $(this).attr('tab-selector');
  tabstate[target] = [];
   $(this).find('li a').each( function() {
   $(this).find('li a').each( function() {
     var selection = $(this).attr('tab-selection');
     var selection = $(this).attr('tab-selection');
    //TODO defaults
     $(this).on('click', function() {
     $(this).on('click', function() {
       $('#'+target+' div').hide();
       $('#'+target+' div').hide();
       var todo = 0;
      tabstate[target][selector] = selection;
       $('#'+target+' div[tab-content="'+todo+'"]').show();
       var content = tabstate[target].join(' ');
       $('#'+target+' div[tab-content="'+content+'"]').show();
     });
     });
   });
   });

Navigation menu