flickity icon indicating copy to clipboard operation
flickity copied to clipboard

Uncaught TypeError: Cannot read property 'option' of undefined

Open andreg opened this issue 10 years ago • 3 comments

Hi,

I'm using version 2.0.5, and initializing the script via HTML with the following options:

{"cellAlign":"left","cellSelector":".block","prevNextButtons":false,"watchCSS":true,"groupCells":true}

and I get the following error:

Uncaught TypeError: Cannot read property 'option' of undefined

which is related to the following lines:

if ( this.element.flickityGUID ) {
    var instance = instances[ this.element.flickityGUID ];
    instance.option( options );
    return instance;
  }

In our case, the this.element.flickityGUID variable is equal to 1 but the instances object is emtpy.

Could you please look into this? Thanks!

andreg avatar Nov 04 '16 08:11 andreg

I'm sorry to see you're having trouble with Flickity. Could you provide a reduced test case? See Submitting Issues in the contributing guidelines.

desandro avatar Nov 04 '16 13:11 desandro

Hey there, I discovered what the issue was: by accident, I was importing the Flickity .js file twice, and that generated the error. Removing one of the two resources fixed the error.

It might be worth investigating a little bit this particular case, though, since it would occur again the moment you include an external library, or plugin, that is also using Flickity for some reason.

andreg avatar Nov 10 '16 15:11 andreg

Thanks for following up.

desandro avatar Nov 10 '16 17:11 desandro