Open ghost opened 9 years ago
It's fine method, but ideally – you should at first enter fullscreen and only then init PhotoSwipe. I'd recommend to fork the default UI and exclude default fullscreen feature entirely.
it works well however a error thrown when exiting by pressing esc key.
Make sure that you aren't calling any method on PhotoSwipe that is already destroyed (closed).
Hi, the issue with _listeners also affects my project, my question is - any time I close (by clicking on close button) photoSwipe - should I init() again ? or create new instance ?
@rodislav, close()
destroys PhotoSwipe instance, you can not execute anything after it, PhotoSwipe is in memory only when it's open.
my question is - any time I close (by clicking on close button) photoSwipe - should I init() again ? or create new instance ?
Create new instance.
ok, got it thanks a lot for help!
could you please add an example how to implement this the right way? I also would like to have a no-thumbnail gallery that starts in fullscreen mode directly when visiting the site. Currently I played with the examples, but when hitting the esc key the page is blank (as there is nothing else). It would be really nice if photoswipe supported a fullscreen gallery by default. Here is a fork of the old photoswipe that shows very well, what I want, but it is, well, based on the old version... would be great to have this in your version! Thanks for your attention! https://github.com/jonathanbell/photoswipe
hi I want to listen to is the photo full screen or not. but listen function not working. "gallery.listen('requestFullscreen',function(){console.log('requestFullscreen');});" please help
thank you.
I developed a library to allow PhotoSwipe to open in fullscreen mode with support for deep linking to specific gallery images. Here's the code needed to do so, which uses the initPhotoSwipeFromDOM
function from the PhotoSwipe docs:
fetchInject([
'/css/vendor/photoswipe/photoswipe.css',
'/css/vendor/photoswipe/default-skin/default-skin.css',
'/js/vendor/photoswipe/photoswipe.min.js',
'/js/vendor/photoswipe/photoswipe-ui-default.min.js'
]).then(() => {
initPhotoSwipeFromDOM('[itemtype="http://schema.org/ImageGallery"]')
})
It loads everything in asynchronously in parallel, so you won't need to add any link
or script
tags directly to your markup to get PhotoSwipe loaded.
More info here: https://github.com/jhabdas/fetch-inject#loading-and-handling-composite-libraries
Hello everyone, the way I solve this problem was like this:
var gallery = new PhotoSwipe($pswp, PhotoSwipeUI_Default, container, options);
gallery.init();
let psAPI = gallery.ui.getFullscreenAPI();
psAPI.enter();
gallery.listen('close', function (name) {
psAPI.exit();
});
Hope it helps!
Hello everyone, the way I solve this problem was like this:
var gallery = new PhotoSwipe($pswp, PhotoSwipeUI_Default, container, options); gallery.init(); let psAPI = gallery.ui.getFullscreenAPI(); psAPI.enter(); gallery.listen('close', function (name) { psAPI.exit(); });
Hope it helps!
This will not work in mobile
Is there a current/planed option for this? I'm actually using this:
is this a good approach?
Also i'm listening on
fullscreenchange
event and closing the photoswipe when fullscreen exited:it works well however a error thrown when exiting by pressing esc key. looks like
_listeners
is already null heretemporarily fixed like this: