Reputation: 1066
ive been researching a ton on this and am coming up at a loss.
Not really sure what is going on, but I can't get this .animate() to animate properly.
I made a JS fiddle outlining the way I have things set up. Basically, its 4 slides, each is 100% height and 100% width, I am getting the slide target dynamically from each link in each slide.
I made a jsFiddle to try and get it to work properly:
http://jsfiddle.net/mikelegacy/WrZev/
Here is the jquery I am using, you'll have to look at the jsFiddle to get the full scope of things, though.
$("a.scrollButton").click(function(e) {
var slideId = $(this).attr("href");
$("html, body").animate({
scrollTop: $(slideId).offset().top
}, 2000);
});
Upvotes: 0
Views: 148
Reputation: 18685
change a.scrollButton to a.slideButton as you have it in your HTML.
$("a.slideButton").click(function(e) {
var slideId = $(this).attr("href");
$("html, body").animate({
scrollTop: $(slideId).offset().top
}, 2000);
return false;
});
http://jsfiddle.net/calder12/WrZev/2/
Upvotes: 1