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

Event 'before.lory.slide' reports wrong 'nextSlide' #520

Open
UTurista opened this issue Dec 13, 2016 · 2 comments
Open

Event 'before.lory.slide' reports wrong 'nextSlide' #520

UTurista opened this issue Dec 13, 2016 · 2 comments
Assignees
Labels

Comments

@UTurista
Copy link

The slides reported by the before.lory.slide event are wrong when the method slideTo( k ) is used.

This because the value nextSlide is defined by direction and by incrementing the current index;

var nextSlide = direction ? index + 1 : index - 1;

dispatchSliderEvent('before', 'slide', {
   index: index,
   nextSlide: nextSlide
});

The following example:

var simple =  lory(target, {
    infinite: 1,
    slidesToScroll: 1
});

// Listeners
body.addEventListener('before.lory.slide', function(e){
  console.log("before(" + e.detail.index + " => " + e.detail.nextSlide + ")");
});
body.addEventListener('after.lory.slide', function(e){
  console.log("after(" + e.detail.currentSlide + ")");
});

simple.slideTo(3);
simple.slideTo(1);

will return the follow output

before(1 => 0)
after(4)
before(4 => 3)
after(2)

instead of

before(1 => 4)
after(4)
before(4 => 2)
after(2)
@nstanard nstanard added the bug label Dec 13, 2016
@nstanard nstanard self-assigned this Dec 13, 2016
@nstanard nstanard added bug and removed bug labels Dec 13, 2016
@nstanard
Copy link
Collaborator

http://codepen.io/nstanard/pen/eBLXJJ

If you've got time go ahead and open a PR with the fix. ;]

@graciano
Copy link

graciano commented Jun 7, 2017

Is there more to be done in this PR or the project is no longer being maintained?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants