So I have one button I'm trying to get multiple functions to work with. On page load the above div is hidden, once the button is clicked it will make the div visible and scroll to the top. I can get both working separately but not together. Can someone point out what I'm doing wrong?
$(function () {
$("#work").hide();
$(".button").bind("click", function () {
$("#work").show();
});
$(".button").click(function () {
$('html, body').animate({
scrollTop: $("#work").offset().top
}, 2000);
});
});
UPDATE 1:
Added a fiddle: http://jsfiddle.net/5qQJN/1/
UPDATE 2:
So it manages to work but only after you click it once. Say you click it, jumps to the top, you scroll down click again and then it will scroll with animation.. so does that mean I need a window load?