I am stuck in a situation where I am injecting waypoints back into the dom using ajax. these new elements wont fire the existing waypoint created before the dom changed.
is there a way to use jquerys On event with waypoints?
I am using waypoints 2.0.2 http://imakewebthings.com/jquery-waypoints/ An example case of what i am trying to do is, re instert waypoints that can still use the waypoint method applied to the element specified with .waypoint
The issue I have is that after I insert new divs that are to be waypoints, they do not trigger.
A similar issue happens when you dynamically insert an element that has a click function attached to it after the dom has loaded once, you can not use .click, you use .on("click, "element", function().
one way to get this to work is to just recreate the waypoint inside the waypoint using:
(".nacho").waypoint(function(direction)
Except the reason this doesnt work in my situation is that all previous triggered or scrolled past waypionts will trigger.
<div class="nacho">
</div>
<script>
$(document).ready(function(){
$("body").on("waypoint", ".nacho", function(event){
//alert("test");
});
$(".nacho").waypoint(function(direction){
alert("test");
$("body").append("<div class=nacho>html to force the window down</div>");
} , { offset: "bottom-in-view" });
});
</script>
I tried to reinsert the waypoint nacho back into the dom, after doing so, even with this ON, the waypoints do not trigger.