I have a simple set of two buttons that, when hovering, should move the div up and down to mimic the scroll effect:
$("#down").hover(function () { $('.scroll').animate({ "marginTop": "-=50px" }, "fast"); }); $("#up").hover(function () { $('.scroll').animate({ "marginTop": "+=50px" }, "fast"); });
However, I have two problems:
1.) I need him to stop when he gets to the end, and then hide the button so that they know that they have reached the end.
2.) It should constantly scroll when the user hovers over the mouse, currently it only does it once on the mouse, and then starts it again when leaving the mouse.
3.) If the content does not exceed the height of the parent element, hide both buttons, since we do not need to scroll them.
Can anyone help?
I thought that maybe 1 could be solved by knowing the height of the scroll bar and judging by its offset to its parent element, which holds it, and creates a frame view?
thanks
source share