It's a Flickity carousel which contains images that open in PhotoSwipe.
There are a
tags within the Flickity Slides which "work", but the PhotoSwipe modal flashes prior to the window.location
changing (default HTML click).
I need some kind of test before running openPhotoSwipe()
and had tried the following, but it (of course) only works on the second click:
$gallery.dataset = [];
$gallery.dataset.linkClicked = false;
$('.project-archive-link').on('click', function() {
$gallery.dataset.linkClicked = true;
});
$gallery.on('staticClick.flickity', function(event, pointer, cellElement, cellIndex) {
if (!cellElement) {
return;
}
// Photoswipe functions
var openPhotoSwipe = function() {
...
if ($gallery.dataset.linkClicked === false ) {
openPhotoSwipe();
}
This is a CodePen with the basic framework.
I'm betting my approach is wrong.