【发布时间】:2015-03-01 13:11:34
【问题描述】:
var item = $('.card');
var pageLoaded = false;
var waypoints = item.waypoint(function(direction) {
if($('.content').css('display') !== 'block'){
console.log('yes it did fire here');
$(this).addClass("animated doneAnimated" + (pageLoaded ? " fadeInUp" : ""));
}
}, {
offset: '90%'
});
pageLoaded = true;
以上代码在 jquery 中工作,但我切换到 zepto。我不知道为什么 zepto 中的 $(this) 是别的东西。如何用纯js编写让代码生效?
【问题讨论】:
-
如果“纯 JS”是指“没有其他人编写的 JS 库”- 你不能。
$函数创建一个 jQuery(或 Zepto)对象。不使用库就不能使用 jQuery(或 Zepto)库。
标签: javascript jquery zepto