jQuery Mobile lazy load list items

前端 未结 3 1008
Happy的楠姐
Happy的楠姐 2021-02-11 00:55

How do you know that you are at the bottom of a list in jQuery Mobile, I need to lazy load in more results when the end of the list is reached?

3条回答
  •  北恋
    北恋 (楼主)
    2021-02-11 01:42

    There is a working example of using scrollstart and scrollstop events here, that should get you going in the right direction: http://jsfiddle.net/shanabus/LJTJt/

    Documentation page here: http://jquerymobile.com/test/docs/api/events.html

    Hope this helps!

    UPDATE

    With help from this post, I was able to wire up a better example that does detection against the bottom of the page. If your list view is not in the bottom of the page, this will not work as well. Check the console for some position debug information.

    http://jsfiddle.net/shanabus/LJTJt/1/

    Here it only adds a new item when you reach the bottom of the list.

提交回复
热议问题