Forums

FancyBox for WordPress
Bug Report: FancyBox makes galleries of all thumbnail images (6 posts)

  1. LincolnAdams
    Member
    Posted 1 year ago #

    I've set Fancybox to only make galleries of images within posts, instead it creates a gallery that includes unrelated images located in my sidebar as well. The code it uses does not distinguish between images contained with the post class and images outside of it. Is there a custom query workaround that can prevent this? Otherwise it's something that would need to be fixed for the next release.

  2. LincolnAdams
    Member
    Posted 1 year ago #

    I've discovered the reason why it does this: on single post pages rather than using the correct query to only open images within the post class, it instead uses this query:

    jQuery(thumbnails).addClass("fancybox").attr("rel","fancybox").getTitle();

    The correct query for single posts should be:

    var posts = jQuery('.post');
    
    		posts.each(function() {
    			jQuery(this).find(thumbnails).addClass("fancybox").attr('rel','fancybox'+posts.index(this)).getTitle()
    		});
  3. -bene-
    Member
    Posted 1 year ago #

    Yay, works great now, thanks! :)

  4. LincolnAdams
    Member
    Posted 1 year ago #

    You're welcome!

  5. ohburnie
    Member
    Posted 9 months ago #

    This solves the problem of galleries on the same page but in different posts merging together in one fancybox.
    Thank you!!!!

  6. LincolnAdams
    Member
    Posted 9 months ago #

    You're welcome! :-D

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic