AINIforever
2016-11-22 21:47
我们现在写网页不允许引用框架,我现在对Jquery还不熟,按照老师的来写css和js文件后,依旧无法实现效果,请问我要怎么解决这个问题呢
老师写的这个插件 ,有依赖jquery库,向页面中的获取节点 链式操作,设置属性啦 这类的jquey的写法你该成原生的写法就好了
$(function() { var $window = $(window), win_height_padded = $window.height() * 1.1, isTouch = Modernizr.touch; if (isTouch) { $('.revealOnScroll').addClass('animated'); } $window.on('scroll', revealOnScroll); function revealOnScroll() { var scrolled = $window.scrollTop(), win_height_padded = $window.height() * 1.1; // Showed... $(".revealOnScroll:not(.animated)").each(function () { var $this = $(this), offsetTop = $this.offset().top; if (scrolled + win_height_padded > offsetTop) { if ($this.data('timeout')) { window.setTimeout(function(){ $this.addClass('animated ' + $this.data('animation')); }, parseInt($this.data('timeout'),10)); } else { $this.addClass('animated ' + $this.data('animation')); } } }); // Hidden... $(".revealOnScroll.animated").each(function (index) { var $this = $(this), offsetTop = $this.offset().top; if (scrolled + win_height_padded < offsetTop) { $(this).removeClass('animated fadeInUp flipInx flash') } }); }})
我是新手,目前还不懂Jquery,请问改成原生写法怎样改呢,能不能帮忙示范一下?
JS插件开发之LightBox图片画廊(上)
27073 学习 · 87 问题
相似问题