将鼠标悬停在文档滚动按钮上

mouseup on the document scroll button

本文关键字:滚动 按钮 文档 鼠标 悬停      更新时间:2023-09-26

当鼠标在文档中为"UP"时,此代码正常工作:

$(document).on("mouseup", function () {
    alert("mouseup");
});

但是当鼠标在滚动按钮上向上时,如何制作alert()

您可以使用"scroll"事件处理程序:

$(window).scroll(function() {
  alert("mouseup");
});

使用 jQuery API:

.mouseup( handler(eventObject) )
$(document).mouseup(function(e){
    if(e.which == 2){                //2 is the code for the middle button
        //some codes...
    }
});

http://jsfiddle.net/DerekL/3wmaK/