jsor / lity

Lightweight, accessible and responsive lightbox.
https://sorgalla.com/lity/
MIT License
1.16k stars 196 forks source link

Strange Issue #38

Closed mikestecker closed 8 years ago

mikestecker commented 8 years ago

I'm having a very strange issue and I'm really not sure exactly where to begin.

The only way I can recreate it with consistant, reproducible results is by having a purposeful error exist in my javascript.

When using concat with Gulp to combine all my scripts together, Lity won't seem to load by default. I have tried going through each combination of leaving out another script here or there to see if there was something conflicting but Lity still would never seem to load correctly. It would always simply link to the external content, be it YouTube or Vimeo, without showing in the lightbox.

I would never see any JS errors mind you... I've even told my console not to clear the errors on navigation so that in case there was something that popped up real quick before it went to the link, but no errors ever stuck.

To test if it was something conflicting, I would try to comment out some of my external scripts that I'm using. Each time I would leave out a script I would comment out whatever code I'm using in my JS that initializes the library so as to remove any errors that might cause... But then I discovered by accidentally forgetting to remove one, Lity finally worked correctly when I saw an error in my code. Once I figured this out, I put all my scripts back in that I wanted to use and simply added an initializer for a script that doesn't exist. In my case, one of my other scripts is Parsley (form validation)... so I duplicated it's init and simply added a 2 to it: $('form').parsley2()

I'm honestly not sure what's going on here. I know it's really strange but I'm not strong enough with javascript to know where to look next. If anyone can help tell me what I should test next that would be great. I don't like having errors in my code so I want to figure out what's going on here.

For reference, here is all the external JS I'm using (and they concat in this order with a ; inserted in between by Gulp):

mikestecker commented 8 years ago

Sorry, Please ignore... I found the error. It was something stupid. Always is huh?

vikchaudhary commented 7 years ago

I had the same problem, and turned out that my script tag right before the Lity include was missing a -- see the modernizr.min.js include.

Once I fixed that, Lity was working again.