Uncaught ReferenceError: PhotoSwipe is not defined


Topic: Uncaught ReferenceError: PhotoSwipe is not defined

Ungr pro asked 6 years ago

Hello guys. I have an error when trying to open lightbox image. Console always throws this.
Uncaught ReferenceError: PhotoSwipe is not defined
at openPhotoSwipe (mdb.js:25884)
at HTMLDivElement.onThumbnailsClick (mdb.js:25793)
// Pass data to PhotoSwipe and initialize it
gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);
gallery.init();
Im including my JS files at the end of page. Do you know any solution to make it working?

Bartłomiej Malanowski staff pro premium commented 6 years ago

Could you please show us more of your code? I recommend you to use our MDB Snippets to do that. You can find that feature here: https://mdbootstrap.com/snippets

Ungr pro commented 6 years ago

I have just copied lightbox 'Gallery with margins' code and pasted it onto my template. See https://mdbootstrap.com/snippets/jquery/ungr/36251

Bartłomiej Malanowski staff pro premium commented 6 years ago

As I can see, everything is working well in your snippet

Ungr pro commented 6 years ago

Seems like the only solution for now is to add another Photoswipe via npm i photoswipe and add PhotoSwipe: 'photoswipe', PhotoSwipeUI_Default: 'photoswipe/src/js/ui/photoswipe-ui-default.js' variables in webpack.

Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Open

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.5.10
  • Device: PC
  • Browser: Chrome
  • OS: Win 10
  • Provided sample code: No
  • Provided link: No