js滑动指定特效

浏览704

我们逛网页的时候有时会看到,鼠标滚动到指定位置就会加载动画,以下是一个方法,仅供大家参考。

主要用了2个文件,jquery.waypoints.jsanimate.min.css

附件:

jquery.waypoints.js.txt

animate.min.css.txt

引入两个文件,在前面加上以下js,还有在每个版块加上class="column"

$(function(){
  reAnimate();
    
})
  
// 滑动指定特效
function reAnimate(){
  var _ele = $(".column");
      _ele.each(function(index, element) {
        var eleAnimate = $(element).find(".animated");
        eleAnimate.css({"animation-name":"none","-webkit-animation":"none"});//移除全部动效
        $(element).waypoint(function(direction){
            if(direction == "up"){
                eleAnimate.css({"animation-name":"none","-webkit-animation":"none"});

              }else{
                eleAnimate.css({"animation-name":"","-webkit-animation":""});
              }

          },{
              offset:"70%"
            });
      });
}



  • 暂无任何回答