Grails: Load Data while Scrolling Page Down

2019-04-16 14:17发布

I want to dynamically load data while Scrolling a GSP Page Down like facebook does.

Is that possible ?

I am using grails 1.3.7 thanks.

2条回答
冷血范
2楼-- · 2019-04-16 14:57

You can detect whether scroller has reached the end of page. If so, just load new piece of information. Something like

$(window).scroll(function(){
    if  ($(window).scrollTop() == $(document).height() - $(window).height()){
       loadNewData();
    }
});

function loadNewData(){
    /* add code to fetch new content and add it to the DOM */
}

Here is an example on jsFiddle

http://jsfiddle.net/QsNCy/

查看更多
欢心
3楼-- · 2019-04-16 15:04

You can also refer tag remotePageScroll of remote-pagination plugin version 0.3, to load and append more records to the existing list on a click of a button, just like what linkedin does. Cheers!

查看更多
登录 后发表回答