Comments (5)
I got the same bug, dunno at the moment why or how to fix it.
from hugo-easy-gallery.
I have the same exact problem. After searching a bit I found the following post:
https://stackoverflow.com/questions/31127896/photoswipe-pswp-class-not-clearing-after-closing-image
Indeed, in load-photoswipe.js the last line that creates and initializes PhotoSwipe is triggered twice because for some reason
$figure.on(/'click/', function(event) {
is being called twice, despite the actual click event only triggered once.
from hugo-easy-gallery.
Turns out the reason this happened in my code is because I was including the load-photoswipe.js code twice, which resulted in registering the on click callback twice. This was entirely my fault because I manually loaded the load-photoswipe.js script in my footer in addition to using the load-photoswipe shortcode. This could most easily be solved by either removing the script in my footer, or using the load-photoswipe-theme shortcode instead. I chose to fix it by always loading photoswipe in my theme's partials and not using either of those shortcodes.
I can confirm once I fixed my bug, things worked as expected. So you may want to double check your code for the on click function being registered twice, etc.
from hugo-easy-gallery.
Perhaps I should put something in load-photoswipe.js to prevent the callback being registered twice.
from hugo-easy-gallery.
I've added a check to load-photoswipe.js that will alert you if you've loaded the js file twice.
If you're going to load the js files in the footer, make sure you follow the instructions at https://github.com/liwenyip/hugo-easy-gallery#theme-integration
The main point is: if you are going to load the js files in the footer of your theme, you need to comment out the <script>
tags in the load-photoswipe
shortcode (or use the load-photoswipe-theme
shortcode).
from hugo-easy-gallery.
Related Issues (20)
- any tips on how to get all of these effects but use {{<instagram>}} instead oof {{<figure>}}?
- Gallery blocking links // crashing site HOT 2
- Congratulations it works on Hugo-XMin too
- images have wrong dimensions HOT 2
- is there a lazy loading feature ? HOT 2
- There is no zoom-in animation when click a thumbnail HOT 1
- Slideshow/carousel instead of gallery HOT 1
- Installation Help HOT 3
- Migrate to an organisation? HOT 2
- Figure captions show above photo and push photo off screen on click
- Weird scrolling incompatibility with OverlayScrollbars HOT 1
- install problem, no layout folder
- Is there any way to set gallery dir to the post leaf bundle directory?
- How to scale thumb images?
- Margins
- image.jpg and image-thumb.jpg both showing as thumbnails HOT 1
- load-photoswipe shortcode does'nt works. HOT 1
- How to load external pictures?
- For anyone struggling to make a grid, here's my active fork HOT 4
- Help - Thumbnails show multiple times on top of each other? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hugo-easy-gallery.