JS Native JS judge scroll bar swipe to the bottom (compatible with Apple Safari)

Source: Internet
Author: User

Listenerscoller () {var pageIndex = 1;     var StartX, Starty;       Document.addeventlistener (' Touchstart ', function (ev) {StartX = Ev.touches[0].pagex;     Starty = Ev.touches[0].pagey;     }, False);    Let _this = this;       Document.addeventlistener (' Touchend ', function (EV) {var endx, EndY;       EndX = Ev.changedtouches[0].pagex;       EndY = Ev.changedtouches[0].pagey;      var dy = Starty-endy;      var reach = Boolean; var scrolltop = Document.documentElement.scrollTop | | Window.pageyoffset | |      Document.body.scrollTop;       Console.log (scrolltop); Document.documentElement.scrollHeight = = Document.documentElement.clientHeight | |Document.body.clientHeight (compatible with Apple Safari)+ scrolltop?        Reach = True:reach = False Console.log (REACH) if (dy>30 && reach) {pageindex++; _this.setstate ({isload:true}) _env.post (_env.        host+ '/distributor/ticket-record?page= ' +pageindex). Then (data + + let NewData = data.data.list;        Let original = _this.state.buys; if (data.data.isLastPage) {_this.setstate ({loadtext: ' No more Data '})} let arr = Ori        Ginal.concat (NewData);        Console.log (arr);      _this.setstate ({Buys:arr});      }). catch (error=>{Console.log (Error);    }); }}, False);}

  

JS Native JS judge scroll bar swipe to the bottom (compatible with Apple Safari)

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.