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.