为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

正在回答

3 回答

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

0 回复 有任何疑惑可以回复我~
#1

AINIforever 提问者

您能帮我把下面那段改成原生代码吗?这是我在网上看的实现随页面滚动加载元素的js代码,但是对于jq不通。。。能帮忙的话感激不尽!
2016-11-24 回复 有任何疑惑可以回复我~
#2

AINIforever 提问者

代码放下面了,希望能帮忙,谢谢
2016-11-24 回复 有任何疑惑可以回复我~
$(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')
    	}
    });
}})


0 回复 有任何疑惑可以回复我~

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

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

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

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号