lokesh / lightbox2

THE original Lightbox script (v2).
http://lokeshdhakar.com/projects/lightbox2/
MIT License
6.24k stars 1.77k forks source link

Rails 7.1 jQuery not available #747

Closed isteel closed 9 months ago

isteel commented 9 months ago

Apologies if this isn't an issue with Lightbox2 as such but I'm raising in case it needs investigating - please delete if inappropriate.

Using rails 7.1 with importmap to load lightbox2 and jquery results in an error when lightbox does:

root.lightbox = factory(root.jQuery);

it produces an error of

Uncaught TypeError: Cannot read properties of undefined (reading 'jQuery')

importmap.rb pin "jquery", to: "https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.js" pin "lightbox2", to: "lightbox2.js"

application.js import "jquery" import "lightbox2"

isteel commented 9 months ago

Resolved following change to rails importmaps. Not a Lightbox issue.

jpbarbosa commented 3 months ago

Hello @isteel,

I'm getting the same problem. Please, could you share your fix?