$(document).ready(function(){
// jQuery code is in here 此处的代码均使用了$
});
报错:“$ is not a function ”
plugins插件中引入 jQuery
时,您必须使用 jQuery
,并且不使用 $
(这是为了与其他库兼容)
最终将使用$的地方,全部替换换为jQuery,解决了这个错误
jQuery(function() {
var elementTop = jQuery(".module-caption").offset().top;
var windowHeight = jQuery(window).height();
window.onresize = function() {
var windowHeight = jQuery(window).height();
}
jQuery(window).scroll(function() {
var windowTop = jQuery(document).scrollTop();
if(windowHeight + windowTop > elementTop) {
var n = document.getElementsByClassName("words-active");
for(var e = 0, t = n.length; e < t; e++) {
var a = n[e],
r = a.textContent.trim();
// a.innerHTML = 'null';
a.innerHTML = '';
i(a, r)
}
function i(n, e) {
for(var t in e) {
var a = document.createElement("span");
a.innerHTML = e[t] === " " ? " " : e[t];
n.appendChild(a)
}
}
}
})
}) //words动画效果