JS Mobile drop-down refresh, pull-up load more.

Source: Internet
Author: User

function Refresh (refresh,loadmore) {
$ (window). Scroll (function () {
Console.log (' sliding f ');

var scrolltop = $ (this). ScrollTop (); Height of scroll bar from top
var scrollheight = $ (document). Height (); The total height of the current page
var clientheight = $ (this). Height (); The currently visible page height
Console.log ("Top:" +scrolltop+ ", Doc:" +scrollheight+ ", Client:" +clientheight ");
if (scrolltop + clientheight >= scrollheight) {//distance top + current Height >= The total height of the document represents sliding to the bottom count++;//sliding count plus 1 per slide
Filterdata (Servicetypeid,industryid,cityid,count); Call the filter method, count is the current number of pages
Console.log (' drop down ');

if (Loadmore) {
Loadmore ();
}
}else if (scrolltop<=0) {
The height of the scroll bar distance from the top is less than or equal to 0 TODO
Alert ("Drop-down refresh, what method to call in this?") ");

Console.log (' pull-up ');
if (refresh) {
Refresh ();
}

}

});

}
var fn1,fn2;
Refresh (FN1,FN2);

Original: https://www.cnblogs.com/handsomeBoys/p/6557839.html

JS Mobile drop-down refresh, pull-up load more.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.