I am trying to automatically click a link when I scroll down to the bottom. It then loads some content with another link that does the same. This works perfectly for the first time but when the next link is loaded via AJAX it does not get clicked anymore. I assume it has something to do with the DOM not getting rebuild. Thank you.
$(window).on('scroll', function() {
timeout = window.setTimeout( check, 100);
});
function check(){
if (($(window).scrollTop() + $(window).height()) >= ($('body').height() * 0.9)) {
alert('Call me!');
$('.selector').click();
}
}