2016-03-07 57 views

回答

1

我相信是scroll事件的结合,与类.fixed-table-body元素的问题,不存在,直到引导表有完成渲染。

为了解决这个问题,在引导表的post标题事件触发时绑定滚动事件。

$("table").on("post-header.bs.table",function() { 
    $("#console").append("<div>hello</div>"); 

    $('.fixed-table-body').unbind().on("scroll", function() { 
     $("#console").append("<div>hello</div>"); 
    }); 
}); 

http://jsfiddle.net/v0c4rtnf/9/

+0

你能告诉我你怎么知道'post-header.bs.table'元素?无论如何谢谢师父! – andrefadila

+1

@andrefadila查看http://bootstrap-table.wenzhixin.net.cn/documentation/#events上的文档中的事件我最初认为它可能是post-body.bs.table事件,但事实证明标题是正确的。 – Valeklosse

0

尝试用下面这样的jQuery它会帮助你。

$("table").on("post-header.bs.table",function() { 
$('.fixed-table-body').on("scroll", function() { 
    if($(this).scrollTop() + $(this).innerHeight()>=$(this)[0].scrollHeight) 
    { 
     alert('end reached'); 
    } 
    }); 
}); 
+0

我知道这是@Valeklosse首先给出的想法之后的正确代码。不管怎么说,还是要谢谢你。 – andrefadila

+0

不客气 –