What Ghost algorithm?

Source: Internet
Author: User

var Testarr = []
var prevscroll = 0
var cache = 0

Scrollfunction(e) {varthat = This; vary =E.detail.scrolltop; //calculate only within a region if(Y > Testarr[0] && y < testarr[testarr.length-1]) { // Down if(Y >=prevscroll) { //TODO: Cache the current zone, varDown = (function(x) {if(y >= testarr[x] && y < testarr[x + 1]) {Console.log (' Down ', ' abcdefghjklmnpqrstwxyz '. Split (') [x]) cache=x}Else { ++x; Down (x); } }); Down (cache); // up}Else { //TODO: Cache the current zone varUp = (function(x) {//if the current is 0 or the current scroll is greater than the current, then the necessary action if(x = = 0 | | y >= testarr[x])return false; //If the scrollbar is up, then it is definitely smaller than the current + + (next). //The main is to judge, whether less than the current, if less than the current, the explanation to take the current-(prev) if(Y <Testarr[x]) {Console.log (' Up ', ' abcdefghjklmnpqrstwxyz '. Split (') [x-1]) Cache= X-1 } }); Up (cache); }} Prevscroll=y}

What Ghost algorithm?

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.