grav-plugin-unitegallery icon indicating copy to clipboard operation
grav-plugin-unitegallery copied to clipboard

Uncaught ReferenceError: jQuery is not defined

Open allgood opened this issue 8 years ago • 2 comments

Using the gallery on a non modular page, I am getting this error:

Uncaught ReferenceError: jQuery is not defined

image

Looks like jQuery isn't loaded at the time the line is executed, If I run the unitegallery() function from javascript console after page loaded, the gallery shows up!

I am using masonry theme. Didn't tried with others.

allgood avatar Nov 02 '17 17:11 allgood

Masonry theme as I see in github (https://github.com/koca/grav-theme-masonry/blob/master/templates/partials/base.html.twig) loads jquery in page footer. Moving jquery loading to page header should make gallery work. This can be done by adding jquery in its own assets group in base template:

assets.add('jquery', {'group':'header', 'priority':101})
assets.js('header')

This is crude fix. I'll try to figure out more general solution

variar avatar Nov 02 '17 19:11 variar

Already figured this out! thank you for your attention!

allgood avatar Nov 02 '17 19:11 allgood