getgrav / grav-plugin-lightslider

Grav LightSlider Plugin
https://getgrav.org
MIT License
14 stars 15 forks source link

Fix jQuery was undefined when trying to include it at the bottom of page #15

Closed Piterden closed 8 years ago

Piterden commented 8 years ago

I've just tried to launch LightSlider when my jQuery lib included at the bottom of page. After having undefined variable JS error I was forced to rewrite some of your JavaScript. You can say: "No problem man, you can use include in at the top for jQuery!!!" and will be absolutely right but I don't want by my personal reason...

Here is the fix for LightSlider plugin that allows it to work even if jQuery included before closed BODY tag. The point is to define id and config as global variables and call init function at the bottom of page, after jQuery and lightslider.js libs.

PS I know that the global vars is an evil, but for now I haven't time...

@TODO wrap in scope

flaviocopes commented 8 years ago

This does not fix the issue for me, I think that if you want to load jQuery at the bottom, then better load ALL the javascript at the bottom, which is something you do on a theme level.

Piterden commented 8 years ago

I don't know where is this problem for you... I've create another one PR, please check this out

16