【问题标题】:Is it possible to bind on the scroll bar?是否可以在滚动条上绑定?
【发布时间】:2013-07-08 14:04:17
【问题描述】:

我现在有如下代码:

 $('body').bind('click', someFunction);

我也想将它绑定到滚动条(整个滚动条区域)。我还没有找到方法来做到这一点?有没有简单的解决方案?

【问题讨论】:

  • 不,除了绑定滚动事件,滚动条上不会触发鼠标事件。
  • @adeneo 我认为可能正在使用丑陋的解决方法
  • 滚动事件还不够吗?
  • 也许这个线程会有所帮助? stackoverflow.com/questions/10045423/…

标签: javascript jquery


【解决方案1】:

您可以改为在滚动时绑定。 There are no mouse events on the scrollbar:

$(window).bind('scroll', someFunction);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-23
    • 2021-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多