Skip to content

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

@sarahkp

Description

@sarahkp

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions