【问题标题】:How to detect whether a div is using scroll in bootstrap twitter? [duplicate]如何检测 div 是否在 bootstrap twitter 中使用滚动? [复制]
【发布时间】:2012-10-29 13:58:22
【问题描述】:

可能重复:
How can I check if a scrollbar is visible?

我有一个带有overflow : auto 的 div,所以我不知道它何时滚动。但这取决于布局。现在我需要知道它何时滚动,以便我可以在其中应用一些业务逻辑。如何捕捉这个事件?

【问题讨论】:

  • 您想知道内容何时超过height 和width?

标签: javascript jquery html css twitter-bootstrap


【解决方案1】:

你可以这样检查。当内容发生变化时,您需要附加一个处理程序。并检查width、height和scrollWidth、scrollHeight的内容是否相等。

你可以使用 jQuery,这样:

if ($("div").scrollHeight == $("div").height)
   // Has Scrollbars

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-04-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多