Created
January 31, 2014 20:51
-
-
Save iacutone/8742880 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a.next').on("click", function(){ | |
var h3 = $("h3.active").text(); | |
switch (h3) { | |
case "1. Select Your Organization": | |
$('div.your_org').children('h3').removeClass('active'); | |
$('div.your_info').children('h3').addClass('active'); | |
$('.your_info').slideDown('slow'); | |
$('.your_org').slideUp('slow'); | |
$('a.back').show(); | |
$('.new_org_submit').hide(); | |
break; | |
case "2. Your Information": | |
$('div.your_info').children('h3').removeClass('active'); | |
$('div.shipping_info').children('h3').addClass('active'); | |
$('.your_info').slideUp('slow'); | |
$('.shipping_info').slideDown('slow'); | |
break; | |
case "3. Shipping Information": | |
$('div.shipping_info').children('h3').removeClass('active'); | |
$('div.products').children('h3').addClass('active'); | |
$('.shipping_info').slideUp('slow'); | |
$('.products').slideDown('slow'); | |
$('a.next').hide(); | |
$('#button').show(); | |
break; | |
case "4. Select Products": | |
$('div.products').children('h3').removeClass('active'); | |
break; | |
} | |
}); | |
$('a.back').on("click", function(){ | |
var h3 = $("h3.active").text(); | |
switch (h3) { | |
case "2. Your Information": | |
$('div.your_org').children('h3').addClass('active'); | |
$('div.your_info').children('h3').removeClass('active'); | |
$('.your_info').slideUp('slow'); | |
$('.your_org').slideDown('slow'); | |
$('a.back').hide(); | |
$('a.next').show(); | |
break; | |
case "3. Shipping Information": | |
$('div.your_info').children('h3').addClass('active'); | |
$('div.shipping_info').children('h3').removeClass('active'); | |
$('.shipping_info').slideUp('slow'); | |
$('.your_info').slideDown('slow'); | |
break; | |
case "4. Select Products": | |
$('div.shipping_info').children('h3').addClass('active'); | |
$('div.products').children('h3').removeClass('active'); | |
$('.products').slideUp('slow'); | |
$('.shipping_info').slideDown('slow'); | |
$('a.next').fadeIn(400); | |
$('#button').hide(); | |
break; | |
} | |
}); | |
$(".selector").progressbar({ value: 0 }); | |
//event handler for back and next button | |
$("a.back, a.next").click(function(){ | |
step($(this)); | |
}); | |
var progress = 0; | |
function step(obj) { | |
if (obj.html() == "Back"){ | |
progress -= 33.34; | |
$(".selector").progressbar({ value: progress }); | |
} | |
else if (obj.html() == "Next"){ | |
progress += 33.34; | |
$(".selector").progressbar({ value: progress }); | |
} | |
} | |
// Initial State for Form | |
$('.your_info').hide(); | |
$('.shipping_info').hide(); | |
$('.products').hide(); | |
$('a.back').hide(); | |
$('a.next').hide(); | |
$('#button').hide(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment