Having a couple of small issues with my code. I've written out a JQUERY sequence where you would click "sign up" and you get scrolled down where a form reveals itself. For now I have a button on the bottom where the function closes the form and scrolls you back to the top.
The example can be seen here: http://www.icecable.com/sandbox/priority%5Fsign%5Fup/test.html
Click on "Sign Up Now" and the animation works correctly. Click "Close and Return to Top" and the animation, again, works correctly. The problem comes after this.
If you try clicking on either "Sign Up Now" button the "height" animation begins as normal but there is a large delay on the "scrollTop" animation for no apparent reason.
Here is my code
$(document).ready(function() {
$('.dealer').click(function(e) {
e.preventDefault();
$('html, body').animate({
scrollTop: '860'
}, 1800, "easeInOutQuint");
});
$('.top').click(function(e) {
e.preventDefault();
$('html, body').animate({
scrollTop: '0px'
}, 1500, "easeInOutQuint");
});
$('.dealer').click(function(e) {
e.preventDefault();
$('#priority').animate({
height: 'show'
}, 1200, "easeInOutCirc");
});
$('.top').click(function(e) {
e.preventDefault();
$('#priority')
.animate({
height: 'hide'
}, 590, "easeInQuint");
});
//Form for Distributors
$('.distributor').click(function(e) {
e.preventDefault();
$('html, body').animate({
scrollTop: '860'
}, 1800, "easeInOutQuint");
});
$('.top').click(function(e) {
e.preventDefault();
$('html, body').animate({
scrollTop: '0px'
}, 1500, "easeInOutQuint");
});
$('.distributor').click(function(e) {
e.preventDefault();
$('#distributor').animate({
height: 'show'
}, 1200, "easeInOutCirc");
});
$('.top').click(function(e) {
e.preventDefault();
$('#distributor')
.animate({
height: 'hide'
}, 590, "easeInQuint");
});
});
Anything I'm doing wrong? Is there a way to reset the events after the forms have been hidden again? Any help/insight/resources would be greatly appreciated!
Will