• I’m building a site for a well known photographer.

    Each post contains at least one image. On the blog’s homepage there are therefore 10 posts all with images.

    I’m using the Photoswipe plugin to view images at full-screen size when clicked. I need to do this as the photographer has other requirements this plugin meets.

    My problem is that on the index page any image clicked appears with “Next’ and ‘Previous’ arrows to the images for other posts.

    How can I make sure Photoswipe handles the post images but prevent it from treating the images on the index page as a single gallery?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Do you still need help with this?

    Are you using a WordPress PhotoSwipe plugin, or are you just using the PhotoSwipe standalone library?

    Thread Starter DrSynonym

    (@drsynonym)

    Yes – I’d love help.

    I’m using the plugin. The site is here and you can see the issue on this page.

    https://gregwilliamsinsight.com

    Modify psw.call.js so that it looks like this:

    jQuery(document).ready(function ($) {
    
    	var myPhotoSwipe = $(".gallery").each(function(){
    	$(this).find(".gallery-item a").photoSwipe({ allowUserZoom:false, zIndex:'10000', captionAndToolbarShowEmptyCaptions:false });
    	});
    
    });

    I’ve tested this for a couple days, and it seems to work – all galleries (including the single image ones you’re seeking to accomplish) should now load into separate instances of PhotoSwipe via jQuery.

    Let me know how it goes.

    I’ve also noticed that in most Windows browsers, the background fades abruptly (sort of awkwardly), and closing PhotoSwipe returns the user to the top of the page, instead of the spot where they opened the gallery.

    To fix:
    layout.css
    remove
    float: left;
    from
    article
    and
    .posttext

    This will fix the bug, but you’ll now have your first “between post separator” thingy in your header.

    I’m not familiar enough with your code to know why, exactly, but it shouldn’t be too hard to figure out an alternate way to get it back into place.

    I’m not sure what the source of this bug is… Another PhotoSwipe-enabled site exhibited this same behavior, only this time caused by declaring (and fixed by removing) a height property on the html element.

    Weird!

    Thread Starter DrSynonym

    (@drsynonym)

    Thanks. The only problem with the code posted is that you lose the toolbar at the base of the page and thus there’s no easy way to close the enlarged image and go back to the post. Any ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Need to unlink images on index page’ is closed to new replies.