$(document).ready(function () {
$(".numField").bind("click",function () {
//this will retrieve the stageCont with the associated numField
var target = $($(this).attr('href'));
//find the siblings of the clicked element
var others = target.siblings().filter(function() {
return ($(this).hasClass('numField') === false);
});
//if element is not the active element...
if (!$(this).hasClass('active')) {
var stageBtns = $(".numField"); //get list of the buttons
//hide each stageBody of the non-active elements
others.each(function(index, self) {
//remove the Class of the associated numField
//.prev() to get the adjacent element
$(this).prev().removeClass('active');
/*********************Commented out because does not work on JsFiddle
//slide close the sibling stages
$(this).hide("slide", {direction: "left"}, 700 );
*/
$(this).hide();
});
//set the numField active
$(this).addClass('active');
/*********************Commented out because does not work on JsFiddle
window.setTimeout( function () {
//show the target
target.show("slide", {direction: "left"}, 700);
}, 700);
*/
target.show(); //this is the simpler code that will work
}
});
$('#stage2Cont').hide();
$('#stage3Cont').hide();
});
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.