请问这个效果是一定要引用JQuery的文件吗

来源:3-4 初始化弹出框

AINIforever

2016-11-22 21:47

我们现在写网页不允许引用框架,我现在对Jquery还不熟,按照老师的来写css和js文件后,依旧无法实现效果,请问我要怎么解决这个问题呢

写回答 关注

3回答

  • 慕无忌0415249
    2016-11-23 19:37:51
    已采纳

    老师写的这个插件 ,有依赖jquery库,向页面中的获取节点 链式操作,设置属性啦 这类的jquey的写法你该成原生的写法就好了

    AINIfo...

    代码放下面了,希望能帮忙,谢谢

    2016-11-24 00:52:32

    共 2 条回复 >

  • AINIforever
    2016-11-24 00:51:33
    $(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')
        	}
        });
    }})


  • AINIforever
    2016-11-24 00:19:44

    我是新手,目前还不懂Jquery,请问改成原生写法怎样改呢,能不能帮忙示范一下?

JS插件开发之LightBox图片画廊(上)

图片画廊插件开发综合演练,快来加入我们的课程吧

27073 学习 · 87 问题

查看课程

相似问题