Title: [Plugin: Fancybox for WordPress] Multiple Galleries on One Page
Last modified: August 20, 2016

---

# [Plugin: Fancybox for WordPress] Multiple Galleries on One Page

 *  [jaeeun](https://wordpress.org/support/users/jaeeun/)
 * (@jaeeun)
 * [13 years, 10 months ago](https://wordpress.org/support/topic/plugin-fancybox-for-wordpress-1/)
 * Hi,
 * When I add multiple NextGen galleries to a page and I view them via Fancybox,
   they don’t end after each gallery. The user is able to scroll through all the
   NextGen Gallery images on that page as if they were all part of the same gallery.
 * Does anyone know how this can be changed to show only per gallery?
 * Thank you,
 * Jaeeun

Viewing 1 replies (of 1 total)

 *  [lxg](https://wordpress.org/support/users/mastermind/)
 * (@mastermind)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/plugin-fancybox-for-wordpress-1/#post-2900512)
 * I had the same issue today, I solved it like this: On the plugin settings page,
   go to the “Galleries” tab and select “Use a custom expression to apply FancyBox”.
   Then paste the following code into the textarea:
 *     ```
       var gCount = 0;
       jQuery('div.gallery').each(function(k, $gallery){
           ++gCount;
           jQuery(thumbnails).each(function(k2, thumb){
               var $thumb = jQuery(thumb);
               if ($thumb.closest($gallery).length)
               {
                   $thumb.addClass("fancybox").attr("rel","fancybox"+gCount).getTitle();
               }
           });
       });
       ```
   
 * NB: There are dozens of forum post related to this issue, however they relate
   to different implementations of Fancybox plugins for WP. This fix refers only
   to the “Fancybox for WordPress” plugin found at [http://wordpress.org/extend/plugins/fancybox-for-wordpress/](http://wordpress.org/extend/plugins/fancybox-for-wordpress/).
 * Sorry for digging up a 7 months old post, but this issue seems to bother quite
   a lot of people, so I thought a fix might be helpful.

Viewing 1 replies (of 1 total)

The topic ‘[Plugin: Fancybox for WordPress] Multiple Galleries on One Page’ is closed
to new replies.

## Tags

 * [multiple](https://wordpress.org/support/topic-tag/multiple/)
 * [one page](https://wordpress.org/support/topic-tag/one-page/)

 * 1 reply
 * 2 participants
 * Last reply from: [lxg](https://wordpress.org/support/users/mastermind/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/plugin-fancybox-for-wordpress-1/#post-2900512)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
