(function(w,d,u){
var k = function(cb){
window.addEventListener('scroll',function(cb){
var scrll = this.scrollY;
if(cb){
cb.call(this,scrll);
}
},false);
};
return (window.scrollex=k);
})(this,document);
当我尝试运行它时,它根本不起作用。我不断得到 undefined is not a function,这是为什么呢?它是否与它在 eventListener 中的某些东西有关?或者我在函数内部传递了参数?太疯狂了,我已经使用了很多次了,只是现在在 eventListener 中似乎遇到了问题。
任何人都可以在这个问题上启发我吗?
现实生活中的例子
scrollr('element',{
max:500,
min:400,
swing:50,
name:"custom_event",
dir:"left",
trigger:"mousemove || scroll"
},function(t,a,c){
//t returns an object
//a returns the current position of the trigger if it is a mousemove or scroll
//c returns a boolean, which is if the element is inView of the viewport
});