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

undefined error when infiniteSlides = false and showMultiple = X #659

Closed
sarahkp opened this issue Dec 1, 2017 · 2 comments
Closed

undefined error when infiniteSlides = false and showMultiple = X #659

sarahkp opened this issue Dec 1, 2017 · 2 comments
Labels

Comments

@sarahkp
Copy link

sarahkp commented Dec 1, 2017

Hello,

I'm getting an undefined error from the getDim method:

Uncaught TypeError: Cannot read property '0' of undefined
at $.anythingSlider.base.getDim (jquery.anythingslider.js:570)

when I click a panel whose number is > than the startPanel setting, and when I have infiniteSlides set to false. This error does not occur when infiniteSlides is set to true.

I've downloaded the demo code from here, and have modified #slider1 options as follows:

showMultiple	: 2,
startPanel : 5,
resizeContents : false,
infiniteSlides : false,
easing : 'easeInOutBack',
navigationFormatter : function(index, panel){
  return ['Slab', 'Parking Lot', 'Drive', 'Glorius Dawn', 'Bjork?', 'Traffic Circle'][index - 1];
},
onSlideComplete : function(slider){
  // alert('Welcome to Slide #' + slider.currentPage);
}

I believe this is happening due to infiniteSlides being set to false, so no cloned panels are inside the base.panelSize[] array, making the array (sometimes) shorter than the max [t value] we're trying to access inside the o.showMultiple loop.

Do you have any suggestions for fixing this? I've set a condition so that if infinteSlides is false & page != 0, then page is set to 0 before the showMultiple loop begins inside getDim. This fixed the problem for me.

Thank you,
Sarah

@Mottie
Copy link
Contributor

Mottie commented Dec 1, 2017

Hi @sarahkp!

Thanks for reporting this problem. We haven't been doing much with this addon because there are newer and better alternatives out there; but because this was a bug I'll get it fixed for you!

@Mottie Mottie added the Bug label Dec 1, 2017
@Mottie Mottie closed this as completed in 2d36fc2 Dec 1, 2017
@sarahkp sarahkp changed the title undefined error when infiniteSlides = false and showMultiple = true undefined error when infiniteSlides = false and showMultiple = X Dec 1, 2017
@sarahkp
Copy link
Author

sarahkp commented Dec 1, 2017

Thanks @Mottie, I've updated my code with your fix.

Sarah

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

2 participants