How to make jQuery waypoints plugin fire when an element is in view and not scrolled past?

前端 未结 4 1091
不思量自难忘°
不思量自难忘° 2020-12-16 13:34

Please see this:

http://jsfiddle.net/5Zs6F/2/

As you can see only when you scroll past the first red rectangle it turns blue, I would like it to turn blue th

4条回答
  •  独厮守ぢ
    2020-12-16 13:41

    OK. Found a solution which works fine.

        jQuery('.zoomInDownInaktiv').waypoint(function(direction) {
        if (direction === "down") {
            jQuery(this.element).removeClass('zoomInDownInaktiv');
            jQuery(this.element).addClass('zoomInDown');
        }
    }, { offset: '80%' });
    

提交回复
热议问题