getgrav / grav-plugin-lightslider

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

Assign slider instance to globally scoped variable #27

Closed hughbris closed 6 years ago

hughbris commented 6 years ago

Allows access to the full lightSlider API including public methods and its callback properties, and thus resolves #20. (should have put that in commit message :/)

I wasn't sure how best to make this globally available. As you'll see, I've created a nested property attached to a Grav property I invented, which is a property of the global window object. The hierarchical object structure window.Grav.plugins... is a suggestion, and may be a useful structure in other plugins.

I don't mind if this global variable is changed, as long as I can reference the slider instance from any user Javascript.