$.fn.scrollEnd = function(callback, timeout) {
$(this).scroll(function(){
var $this = $(this);
if ($this.data('scrollTimeout')) {
clearTimeout($this.data('scrollTimeout'));
}
$this.data('scrollTimeout', setTimeout(callback,timeout));
});
};
使用
$(currentmkt_div).scrollEnd(()=>{
console.log(this.$store.state.toggleselect.stock);
if(this.$store.state.toggleselect.stock==2){
判断模块,如果是自选股,不滚动切换
return;
};
if(this.scroll_switch){
滚轮事件中是false,请求完数据重置为true
this.scroll_switch=false;
console.log($(thead).height()+'$(thead).height()')
let scrolltop=$(currentmkt_div).scrollTop();
$(thead).css({
'top':scrolltop+'px'
});
$(tmain).css({
'top':scrolltop+$(thead).height()+'px'
})
console.log(thead_scrolltop)
this.startindex=Math.floor(scrolltop/(this.row_period+1)*22/20)
}
},1000)