vodkabears / Remodal

No longer actively maintained.
http://vodkabears.github.io/remodal/
MIT License
2.76k stars 774 forks source link

Error with minify and defer loading #254

Closed Tusko closed 7 years ago

Tusko commented 7 years ago

hi. I have strange error.

when I minified remodal script then load it with defer - have an error: footer-b66a7d8….js:100 Uncaught TypeError: Cannot read property 'on' of undefined

t.each(['$bg','$overlay','$wrapper','$modal'],function(e,t){i[t].on(d,s)

anybody can help ?

brentswisher commented 7 years ago

What did you use to minify it? My guess would be something in the minification process screwed up a variable reference. There is a minified version available here, have you tried using that?

Tusko commented 7 years ago

I using Wordpress and AssetsMinify (plugin, which minify all scripts in one file).

When I connected your minified version of file - all works fine, but I need to use it with WP plugin :(

Tusko commented 7 years ago

Upd.

My plugin AssetsMinify use https://github.com/tchwork/jsqueeze/blob/master/src/JSqueeze.php for minification JS.

I have fixed my problem with renaming vars from $bg, $overlay, $wrapper, $modal to __bg, __overlay, __wrapper, __modal.

Now all works fine :)

Thank you for a great plugin ;)