How to use JQuery .on() to catch the scroll event
问题 I'm attempting to use the .on() from jQuery to catch a scroll event that is inside a tag. so this was my solution: the div id='popup' the .fixedHeader class is something I'm trying have fixed at the top of the div frame. getScrollTop() is a javascript function to return the top value (works) $(document).on("scroll#popup", '#popup', function(){ alert('scrolling'); $(".fixedHeader").css("position", "relative"); $(".fixedHeader").css("top", getScrollTop()); }); 回答1: The event is simply scroll ,