how to kill/stop a jquery/javascript function?
I have a jquery function :
function getArrowScroll(dirX, dirY, ele)
{
return function()
{
arrowScroll(dirX, dirY, this, ele);
this.blur();
return false;
};
}
When the user hover the arrowDown button, it will auto scrolling the contents inside a div :
if (settings.arrowScrollOnHover) {
arrowUp.bind('mouseover.jsp', getArrowScroll(0, -1, arrowUp));
arrowDown.bind('mouseover.jsp', getArrowScroll(0, 1, arrowDown));
}
When the scroll bar reach the bottom of div, jquery get more data from other page and add them to the div. At this point, mouseover.jsp
is lost control already because I reinitialize everything except getArrowScroll(). It will keep scrolling down continuously non-stop by executing getArrowScroll(0, 1, arrowDown)
. I need kill function getArrowScroll(0, 1, arrowDown) before reinitialize, or when
mouseleave.jsp
. If I put :
arrowDown.bind('mouseover.jsp',
getArrowScroll(0, 1, arrowDown)).bind('mouseleave.jsp',
getArrowScroll(0, 0, arrowDown));
it will still scrolling to bottom because getArrowScro开发者_如何学Cll(0, 1, arrowDown) is still running, how to kill or stop function getArrowScroll()?
精彩评论