$(document).ready(function(){
//At start we need to show only first step
$('#steps_container .step').not(':first').hide();
$('#next, #prev').click(function(){
var t = $(this),
current = $('#steps_container').find( '.step:visible' ),
//Below we have an if statement, but the short way . before "?" is the condition
// between "?" and ":" is what we do if it is true and after ":" what is false
stepGo = ( t.attr( 'id' ) == 'next' ? current.next() : current.prev() );
if ( stepGo.length ) { // Check if we still have steps
current.fadeOut( 'slow', function(){
//Here is a callback. Code below will run after the fadeOut stuff was done
stepGo.fadeIn( 'slow' );
});
};
return false; //Now the "click" default action is canceled and it calls only code above
});
});
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.