So I am using jQuery waypoint to get the image id that is viewed on the screen. But I am having problem with content added by AJAX. When I get to the newly added content by AJAX the plugin doesn't work. Here is my code so far:
Waypoint = $('.Picture-1A').waypoint(function(direction){
if(direction == 'down'){
id = $(this.element).children(".PictureID").text();
$.post('ajax/count-pictures-views.php', {picture_id: id}, function(data){
Waypoint.refreshAll();
});
}
});
I have also tried this
instead of Waypoint
which did not work. What can I do to make this work?