[英]Fire event on scrolling an open bootstrap modal
I am using "Bootstrap" modal (actually a branch of it that disables background scrolling when the modal is shown and adds more features - "bootstrap-modalmanager"). 我正在使用“ Bootstrap”模态(实际上,它的一个分支在显示模态时会禁用背景滚动并添加更多功能-“ bootstrap-modalmanager”)。
I need to do something when the modal is being scrolled. 模态滚动时,我需要做一些事情。 The problem is I can't find what is actually being scrolled.
问题是我找不到实际滚动的内容。
When I use Chrome dev tools I can see in the time-line the event "scroll" is bring fired but I can't find where to see the div it scrolls, which I need to know so that I can do: 当我使用Chrome开发人员工具时,可以在时间轴上看到触发了“ scroll”事件,但是我找不到在哪里可以看到它滚动的div,因此我需要知道这一点,以便可以这样做:
this: 这个:
$(window).on('scroll',"THE ID I AM LOOKING FOR",function(){..})
or this: 或这个:
$("THE ID I AM LOOKING FOR").on('scroll',function(){..})
You can look for the target element in the event object. 您可以在事件对象中查找目标元素。 This will tell you where the event was fired.
这将告诉您事件在哪里触发。
$(document).on('scroll', function(e) {
e.target; //e.target will be the DOM element where the scroll event was fired
});
You can pass a different jQuery selector to the 'on' event according to your requirements. 您可以根据需要将其他jQuery选择器传递给'on'事件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.