当我滚动 div 时,基本上什么也没发生。该方法slideIt在对象启动时被触发一次,就是这样。它不是在监听滚动事件!为什么会发生这种情况?
function fixed_column_or_row(container_name){
this.container_div=$(container_name);
this.scrollable_div=this.container_div.find(".simplebar-content-wrapper");
this.fixed_row=this.container_div.find(".fixed-row")
this.fixed_column=this.container_div.find(".fixed-column")
//the issue in this line
this.scrollable_div.scroll(this.slideIt())
}
fixed_column_or_row.prototype.slideIt=function(){
var scrollTop = this.scrollable_div.scrollTop(),
scrollLeft = this.scrollable_div.scrollLeft();
console.log("scrollTop")
this.fixed_row.css({
"margin-left": -scrollLeft
});
this.fixed_column.css({
"margin-top": -scrollTop
});
}
慕侠2389804
相关分类