I have a simple set of two buttons that when hovered should make a div move up and down to simulate a scrolling effect:
$(\"#down\").hover(function () {
$(\
This code still need some debugging, but you can get the idea in it:
$(document).ready(function() {
if ($('.content').height() > $('.container').height()) {
$("#down").hover(function () {
animateContent("down");
}, function() { $('.content').stop(); });
$("#up").hover(function () {
animateContent("up");
}, function() { $('.content').stop(); });
}
});
function animateContent(direction) {
var animationOffset = $('.container').height() - $('.content').height();
if (direction == 'up') {
animationOffset = 0;
}
$('.content').animate({ "marginTop": animationOffset + "px" }, "fast");
}
Code: http://jsfiddle.net/a89DF/6/