Good afternoon, ladies and gentlemen. I want to add more data functions to my mobile website and slide down the Sina Weibo APP scroll bar. How can I implement this function? Could you please give me some advice, if you have any good code, I would like to thank you very much for your good afternoon. I want to add more data functions to my mobile website by sliding down the APP scroll bar of Sina Weibo, how can this function be implemented? Could you please give me some advice and share some good code? Thank you very much
Reply content:
Good afternoon, ladies and gentlemen. I want to add more data functions to my mobile website and slide down the Sina Weibo APP scroll bar. How can I implement this function? Could you please give me some advice, thank you very much for sharing any good code.
This mode is called Infinite Scroll. Various frameworks and class libraries have mature implementations. For more information, see
The idea is very simple (in fact, the implementation is also very simple), that is, ajax background request data is inserted to the end of the document. It doesn't matter if the html string that you rendered in the background is the data provided in the backend and then Javascript is rendered.
$. Ajax ({.... // slightly success: function (data) {$ ('body '). append (data) // Meaning },...})
You can monitor the event of the scroll bar and start loading at PX from the bottom.
$(window).scroll(function() { if ($(document).scrollTop() + $(window).height() > $(document).height() - 100) { $.get(url, function(data) { $('#list').append(data); }); } });
Listen to rolling events and load more images in the callback function
With iScroll. js and ajax request data, you can pull up and load the data, pull down and refresh it. You can try it.