imakewebthings / waypoints

Waypoints is a library that makes it easy to execute a function whenever you scroll to an element.
http://imakewebthings.com/waypoints/
10.38k stars 1.33k forks source link

only if I slide a long distance then the page will infinite scroll up and down #579

Closed ritsuyan closed 7 years ago

ritsuyan commented 7 years ago

Code: $(".screen-li").waypoint({ handler: function(a_c) { console.log("go") var b_c = $(this).attr("no"); "up" == a_c ? ($(".rnav li a").removeClass("active"), $(".rnav li").eq(b_c-1).children("a").addClass("active")) : ($(".rnav li a").removeClass("active"), $(".rnav li").eq(b_c).children("a").addClass("active")) // var c = $(".active").parent().index(); var d = $(".rnav li").eq(c).children("a").attr("href"); a(d), $.scrollTo(d, 800, function() { console.log("scrol") b(d), $(".rnav li a").removeClass("active"), $(".rnav li").eq(c).children("a").addClass("active") }) }, offset:30 }),`