Difference between revisions of "User:Lexar/sandbox/Page.js"

From Team Fortress Wiki
Jump to: navigation, search
m (commenting out my external css to use local css and also removing second class)
m (Adding start and end comments)
Line 1: Line 1:
 
//my js page for general screwin around
 
//my js page for general screwin around
 
//$('head').append('<link href="https://dl.dropboxusercontent.com/u/32668357/wiki_stuff/tempres/style.css" rel="stylesheet" type="text/css" />');
 
//$('head').append('<link href="https://dl.dropboxusercontent.com/u/32668357/wiki_stuff/tempres/style.css" rel="stylesheet" type="text/css" />');
 +
//Start weapon wear table tabs -----
 
var WeaponWearTable = {
 
var WeaponWearTable = {
 
tabSwitch: function($this,tab,weapons,weapon) {
 
tabSwitch: function($this,tab,weapons,weapon) {
Line 22: Line 23:
 
};
 
};
 
$(WeaponWearTable.init);
 
$(WeaponWearTable.init);
 +
//End weapon wear table tabs -----

Revision as of 05:20, 16 July 2015

//my js page for general screwin around
//$('head').append('<link href="https://dl.dropboxusercontent.com/u/32668357/wiki_stuff/tempres/style.css" rel="stylesheet" type="text/css" />');
//Start weapon wear table tabs -----
var WeaponWearTable = {
	tabSwitch: function($this,tab,weapons,weapon) {
		if (!$this.hasClass('current')) {
			var tabIndex = $this.index();
			$this.parent().find('.current').removeClass('current');
			$this.addClass('current');
			weapons.find('.current').removeClass('current');
			weapon.eq(tabIndex).addClass('current');
		}
	},
	init: function() {
		var container = $('.weapon-wear-table');
		container.each(function(){
			var $this = $(this), tabs = $this.children('.tabs'), tab = tabs.children('li'), weapons = $this.children('.weapons'), weapon = weapons.children('li');
			tab.first().addClass('current');
			weapon.first().addClass('current');
			tab.click(function(){WeaponWearTable.tabSwitch($(this),tab,weapons,weapon);});
		});
	}
};
$(WeaponWearTable.init);
//End weapon wear table tabs -----