Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cancel loop scroll still cause the index change #24

Open
you06 opened this issue Mar 11, 2019 · 0 comments
Open

cancel loop scroll still cause the index change #24

you06 opened this issue Mar 11, 2019 · 0 comments

Comments

@you06
Copy link

you06 commented Mar 11, 2019

Suppose we have this requirement:

  • This is a loop scroll application.
  • It can only loop from the end to the start

Then I'm going to cancel the scroll event when it scroll from the start to the end. This is my beforeChange callback function.

beforeChange: function (el, prev, next) {
  console.log('brefore', prev, next)
  if (prev === 2 && next === 2) {
    return false
  }
  console.log('after', prev, next)
}

See JSFiddle demo: https://jsfiddle.net/z4Lvwhr6/

Once open, scroll up for twice, there will be there logs in the console:

brefore 2 2 // no scroll happened, still in page1
brefore 2 1 // scroll from page1 to page2
after 2 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant