Tell me how to scroll elements generated using ajax for example? Those. what to apply where needed instead

$(window).scroll(function () { console.log($(document).height()); }); 

do this way:

 $(window).live('scroll', function() { console.log($(document).height()); }); 

On the Internet, they write that scroll does not support live, but they do not write what to do about it. To dig towards delegate?

  • I didn’t understand much what exactly needs to be done, to catch the scrolling of the generated elements or to scroll through them? -

2 answers 2

 $('#elem').bind('scroll', function(){ alert('bar'); }); 

The delegate, unfortunately, does not help (although suddenly there will be some craftsman?)

    You can go to the trick. In general, the point is that before you start scrolling any element of the page, there should be an event that precedes this. At this event, we "hang up the wiretap." I chose the mouseenter , you - what you see fit. In general, that's what happened .