Bind scroll Event To Dynamic DIV?

前端 未结 9 1417
死守一世寂寞
死守一世寂寞 2020-12-11 16:23

For example, after using AJAX, I\'ll have a scrollable DIV. How to bind scroll events to it?

I\'ve tried:

$(window).on(\"scroll\", \".mydiv\", functi         


        
9条回答
  •  悲&欢浪女
    2020-12-11 17:07

    I'm having the same issue and I've found the following in the jQuery .on() API:

    In all browsers, the load, scroll, and error events (e.g., on an element) do not bubble. In Internet Explorer 8 and lower, the paste and reset events do not bubble. Such events are not supported for use with delegation, but they can be used when the event handler is directly attached to the element generating the event.

    So unfortunately this doesn't appear to be possible.

提交回复
热议问题