jquery spyScroll事件无效 [英] jquery spyScroll events is not working
本文介绍了jquery spyScroll事件无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
ontick不会被调用,但是当我为这个代码量创建一个单独的文件时它会起作用
$(' 。SearchContent5')。each( function (i){
var position = $(这个)。position();
console .log(position);
console .log(' min:' + position.top + ' / max:' + parseInt (position.top + $ ( this )。height()));
$(' < span class =code-string>。SearchContent5')。scrollspy({
min : 10 ,
max:position.top + $( this )。height(),
模式:' vertical',
onTick: function (元素,位置){
alert();
}
});
});
解决方案
(' 。SearchContent5')。each( function (i){
var position =
( this )。position();
console .log(position);
console .log(' min:' + position.top + ' / max:' + parseInt (position.top +
(此跨度>)高度()));
ontick not gets called when i include this code in my project but it works when i made an indiviual file for this amount of code
$('.SearchContent5').each(function(i) {
var position = $(this).position();
console.log(position);
console.log('min: ' + position.top + ' / max: ' + parseInt(position.top + $(this).height()));
$('.SearchContent5').scrollspy({
min: 10,
max: position.top + $(this).height(),
mode: 'vertical',
onTick: function(element, position) {
alert();
}
});
});
解决方案
('.SearchContent5').each(function(i) { var position =
(this).position(); console.log(position); console.log('min: ' + position.top + ' / max: ' + parseInt(position.top +
(this).height()));
这篇关于jquery spyScroll事件无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文