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

Slider freezes on first slide when disableWrap option is set to true #81

Open
joshas opened this issue Nov 26, 2015 · 2 comments
Open

Comments

@joshas
Copy link

joshas commented Nov 26, 2015

Using latest version from repository (2.0.5). Added option disableWrap: true. When spinning with autoplay or manually, slider freezes on reaching first image. Error message:

TypeError: f[e.getNormalizedCurrentFrame(...)] is undefined

Here's an example to quickly reproduce this issue:
https://jsfiddle.net/joshas/5vaenw0s/2/

Frames array is being accessed using values starting from 1, not from 0.

@MolloKhan
Copy link

Hey, I fixed it by doing this onReady callback

onReady: function(){
this.currentFrame = 52;
this.endFrame = 52;
}

@vemacs
Copy link

vemacs commented Jun 14, 2016

@larzuk91's suggestion didn't work either. I fixed this by replacing the function:

base.getNormalizedCurrentFrame = function () {
  var c, e;

  if ( !AppConfig.disableWrap ) {
    c = Math.ceil(AppConfig.currentFrame % AppConfig.totalFrames);
    if (c < 0) {
      c += AppConfig.totalFrames - (AppConfig.zeroBased ? 1 : 0);
    }
  } else {
    c = Math.min(AppConfig.currentFrame, AppConfig.totalFrames - (AppConfig.zeroBased ? 1 : 0));
    e = Math.min(AppConfig.endFrame, AppConfig.totalFrames - (AppConfig.zeroBased ? 1 : 0));
    c = Math.max(c, (AppConfig.zeroBased ? 0 : 1));
    e = Math.max(e, (AppConfig.zeroBased ? 0 : 1));
    if (c == AppConfig.totalFrames) {
      c--;
    }
    AppConfig.currentFrame = c;
    AppConfig.endFrame = e;
  }
  return c;
};

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

3 participants