Support » Plugin: Boxers and Swipers » Photoswipe: site’s links not working after pop-up window closes

  • I have a phantom bug with Photoswipe. The bug happens rarely and seemingly unsystematically.
    Sometimes when I close an image’s pop-up Photoswipe window, I find that all the links that were on the page behind the pop-up window are disabled. The links don’t react to hovering or clicking on them.
    But if I scroll to an area of the page that wasn’t under the pop-up window, links work there!
    This might be a bug of the theme, not of the plugin. I don’t know.

    • This topic was modified 2 years, 8 months ago by  allfadr.
Viewing 7 replies - 1 through 7 (of 7 total)
  • I’ve identified the problem more exactly.
    If i click on a photoswiped image while the page hasn’t yet fully loaded (or been cached by the browser), the image doesn’t open.
    When I click on the image for the second time (when the page has already loaded), it properly appears in a popup photoswipe window.
    BUT when i close the pop-up, there’s abnormal behaviour: the pop-up itself closes, but the image remains on the screen, and the links that were behind the pop-up do not work. Things get back to norm only if i refresh the page or click on a working link (if there is one above or beyond the former popup-up window).
    You can try yourself: https://khorn.by/pra-sajt/
    Click on the photo with the stone monument and green grass before the page loads fully. The photoswipe won’t work. Click the second time, and the Photoswipe will pop-up. Then close the pop-up and see for yourself.

    What is happening here is probably the plugin loading twice (???):
    the first time i click the image, it loads but “not fully”, or something;
    the second time i click the image, it loads fully and works.

    Plugin Author Katsushi Kawamori

    (@katsushi-kawamori)

    Thanks your report.

    It is intended to correspond to the Infinte scroll.
    It was so in order to correspond to the newly appearing image in Infinte scroll.
    Because I do not mind, I am using it as it is.
    I got up to the topic before, but I do not feel like repairing it.

    Thanks.

    Have You tried what the Russian developer proposed in that topic?
    https://wordpress.org/support/topic/photoswipe-code-and-preload/#post-6977305
    I’m not a developer so I don’t quite understand what he proposes but i do speak Russian (natively) so I can give You a good translation.

    Can we create an option in the plugin that would configure it for either infinite scroll or “normal” pages?
    Can we modify the code in a way that the plugin is stable both with infinite scroll and “normal” pages? I guess it might be a simple thing to do.
    What can I do, how can I help make this happen?

    Thanks for the substantial plugin update, Mr. Kawamori. (I mean the 3.0/3.01 update.)
    Now when we use the plugin with Infinite Scroll disabled, there can be a situation when the plugin hasn’t yet fully loaded BUT a user has already clicked on an image. This calls the default WordPress behaviour (such as opening the image in a new tab).
    What do You think about adding one command in the “jquery.boxersandswipers.photoswipe.js” and all similar files so that the default behaviour be suppressed?

    I changed the contents of the aforementioned file like this:

    ...
    	if ( photoswipe_settings.infinitescroll ) {
    		jQuery(".boxersandswipers").live('click', function(e){
    			e.preventDefault();
    			jQuery(".boxersandswipers").photoSwipe(photoswipe_options);
    		});
    	} else {
    		<strong>jQuery(".boxersandswipers").live('click', function(e){
    			e.preventDefault() });</strong>
    		jQuery(".boxersandswipers").photoSwipe(photoswipe_options);
    	}
    });

    [moderator note: Please put code in backticks or use the code button on the editor to mark code blocks.]

    This disables the default WordPress behaviour. If we click on an image before the whole photoswipe script is loaded, nothing happens, and after it’s loaded, there are no bugs.
    Notice that the “click” function (or whatever it is called) does not include the call to Photoswipe. They are on the same hierarchichal level of calling.
    I’m not familiar with Javascript, so this might actually be a stupid suggestion; but at least it works for me.

    • This reply was modified 2 years, 8 months ago by  allfadr.
    • This reply was modified 2 years, 8 months ago by  allfadr.
    • This reply was modified 2 years, 8 months ago by  Steve Stern.

    The “strong” (“/strong”) html tag should be removed from the code above, of course. I was trying to make those lines bold.

    As for the distinct Infinite Scroll mode introduced in the 3.0 update, there’s still a bug which appears if we click on an image before the page loads.
    The first click in this situation does nothing. If the user manages to makes a second click before the script is fully loaded, it still does nothing. The next click will open a normal image pop-up. And when we close this pop-up, we get a buggy screen: the image frozen on the screen and all links (or javascript) not working.

    But I admit that it is quite improbable that many users will run into this bug.

    Plugin Author Katsushi Kawamori

    (@katsushi-kawamori)

    In my environment it works without problems with Infinite Scroll disabled.
    I think there is a problem with the cache of the server and the browser.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Photoswipe: site’s links not working after pop-up window closes’ is closed to new replies.