How do I make the window scroll on mousedown, using jQuery?
I was just wondering why this isnt working:
$('#down-a-bit').mousedown(function(){
setTimeout( $('html, body').animate({ scrollTo开发者_开发技巧p: $(this).offset().top += 1}) ,300);
});
What am I doing wrong? Any help would greatly be appreciated, Thanks
You can use .delay instead of setTimeout. If you use setTimeout, wrap it in a function.
http://jsfiddle.net/pMTsF/
精彩评论