nicolas-t/Chocolat

Several instances with Api open

t-book opened this issue · 0 comments

Hi,

I'm trying to create several galeries:

var show1 = $('#show1').Chocolat({
      'container':'#show1',
   }).data('chocolat');
 show1.api().open();

var show2 = $('#show2').Chocolat({
      'container':'#show2',
   }).data('chocolat');
 show2.api().open();

While the first one is working the second fails with

jquery.chocolat.min.js:1 Uncaught TypeError: Cannot read property 'then' of undefined
    at n.load (jquery.chocolat.min.js:1)
    at n.init (jquery.chocolat.min.js:1)
    at Object.open (jquery.chocolat.min.js:1)
    at HTMLDocument.<anonymous> ((index):473)
    at j (jquery.min.js:2)
    at Object.fireWith [as resolveWith] (jquery.min.js:2)
    at Function.ready (jquery.min.js:2)
    at HTMLDocument.I (jquery.min.js:2)

Can one assist how to correctly open multiple instances!

Grazie mille!