MediaWiki:Gadget-Tabs.js

/*	Simple but flexible javascript tabs v0.4 Author: Abdullah A. Abduldayem Contact: http://www.zeldawiki.org/User:Abdullah See http://www.zeldawiki.org/MediaWiki_talk:Tabs.js for examples and documentation

$(document).ready(function{

// When a tab is clicked $(".tab").click(function {    var $container = $(this).closest(".tabcontainer");    var $tabs = $(this).parent.children(".tab"); //Only siblings are counted    var id = $container.attr('id');    //if (id == undefined || id == "") return;

var $contents = $("." + id + "-contents"); //alert($contents); //if ($contents == null) return;

// switch all tabs off $tabs.removeClass("active");

// switch this tab on   $(this).addClass("active");

// hide all contents $contents.children(".content").css("display","none");

// show contents corresponding to the tab var index = $tabs.index(this); $contents.each(function( i ) {     $(this).children(".content").eq(index).css("display","block");    }); //$contents.children(".content").eq(index).css("display","block"); });	});