html - Can not change class with jquery and waypoints -
i have problem frustrating me. body so:
<div class='chapter'> <div class='side side-right'> <image src="./image1"> <div> <div class='side side-left'> chapter 1 </div> </div>
and in javascript, have:
$(document).ready( function(){ $(".chapter").waypoint(function(e){ if (e=="down" ) {$(this).find(".side-right").addclass("current"); console.log(e);} if (e=="up" ) {$(this).find(".side-right").removeclass("current");console.log(e);} } );
however, class not seem change. console prints "up" or "down" based on how scroll, not notice class changing.
any idea wrong? help.
i using jquery.js , jquery.waypoints.js
k.
this
not html element inside waypoint handler, instance of waypoint class. @ element, use $(this.element)
.
Comments
Post a Comment