lokesh / lightbox2

THE original Lightbox script (v2).
http://lokeshdhakar.com/projects/lightbox2/
MIT License
6.19k stars 1.76k forks source link

Lightbox2 issue with Foundation 6 #578

Closed l0git3k closed 6 years ago

l0git3k commented 7 years ago

Hello,

I'm trying to use Lightbox2 with a Zurb Foundation 6 project and after add the CSS and JS files I get this error on all pages :

Uncaught TypeError: Cannot read property 'jQuery' of undefined at lightbox.js:25 at lightbox.js:14

My jQuery version is the 2.2.4 and the lightbox.js is concat at the bottom of app.js

gordonchanhk commented 7 years ago

Same issue encountered. I am also debugging just now and spot root for root.jQuery is undefined https://github.com/lokesh/lightbox2/blob/master/src/js/lightbox.js#L27

And wonder this should be window? https://github.com/lokesh/lightbox2/blob/master/src/js/lightbox.js#L29

gordonchanhk commented 7 years ago

I find that I have a Gulp script to run Babel with es2015 and turn out the script changing the this in https://github.com/lokesh/lightbox2/blob/master/src/js/lightbox.js#L29 to undefined. Would this be the syntax issue?

so-rose commented 7 years ago

Same issue encountered here. Anybody found a fix by any chance?

mugukamil commented 6 years ago

@so-rose for fixing, we need to add option to .babelrc { "modules": false }.

Because babel 5 when transpiling *.js files, replace all this with undefined

so-rose commented 6 years ago

@mugukamil Thanks for the fix!

lokesh commented 6 years ago

Glad this issue was sorted out. Closing. Thanks to everyone who helped. 👏

uzeehan commented 3 years ago

Hi there, I am having the same issue. I applied the solution mentioned above to change Babelrc option, but it didn't work for me. Babelrc option 'modules:false' stopped GridderJs on the site.

Is there any other solution out there?