[英]JQuery : .one() not work in my site
I have this code for JQuery:- 我有此代码的JQuery:-
$('.ro-news-n img').addClass('no-display');
$('.ro-news-n img').one('inview', function() {
$(this).addClass('appear');
});
This code for hide any image in class .ro-news-n
and show it when scroll page down. 该代码用于隐藏
.ro-news-n
类中的任何图像,并在向下滚动页面时显示。
Its add class no-display for <img>
attribute and when scroll its add appear class to show it. 其
<img>
属性的添加类不显示,滚动时,其添加显示类显示它。
The problem is when open site its add class no-display to <img>
attribute. 问题是当打开网站时,其将未显示类添加到
<img>
属性。 but when scroll its not add appear class to it. 但是当滚动它时,不添加出现类。
why 为什么
尝试这个:
$(this).removeClass('no-display').addClass('appear');
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.