Activate waypoint on top and bottom of div - jQuery -


i'm trying activate waypoint when user scrolls in top , bottom of same div. changes active state on navigation element. know default top of div how do both?

$('#1').waypoint(function() {     $(".desktop-menu ul li").children().removeclass("active"); $(".desktop-menu ul li ul li").children().removeclass("active");     $("#chapt-1").addclass("active");  }, { offset: 0 }); 

append element id="#1-bottom" right after id="#1" element , declare waypoint on too.

then, scrolling top bottom trig #1 waypoint first , scrolling bottom top trig #1-bottom waypoint first.

html

<div id="#1">[...]</div> <div id="#1-bottom"></div> 

jquery

$('#1').waypoint(function () { [top bottom logic] }); $('#1-bottom').waypoint(function () { [bottom top logic] }); 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -