I am using a foreach loop inside of wordpress to give each image's < rel > tag the value of the `$post_ID`. I am also creating a data variable called 'gallery' with a value of the `$post_ID`. I am then using fancybox to call upon my data variable and fire fancybox. 

This all works perfect for the first image gallery, but when I go to the next one it doesn't fire fancybox even though the data value and rel tag values match up on the next galleries.

My jQuery:

```
var galleryvalue = $('.portfolio-gallery').data('gallery');

$("a[rel=" + galleryvalue + "]").fancybox({
    'transitionIn'      : 'elastic',
    'transitionOut'     : 'elastic',
    'cyclic'        : true,
    'autoScale'     : true,
    'showNavArrows'     : true,
    'overlayColor'      : '#666'

    }); 

```

My html:

```
<?php $args = array(
    'post_type' => 'attachment',
    'post_mime_type' => 'image',
    'numberposts' => -1,
    'post_parent' => $post->ID,
    'exclude' => get_post_thumbnail_id(),
); ?>

<?php $images = get_posts( $args );
$imageclass = array( 'class' => "gallery-image");

if (!empty($images)) { 
    foreach($images as $image): ?>
        <a rel="<?php echo $post->ID ?>" class="portfolio-gallery" data-gallery="<?php echo $post->ID ?>" href="<?php echo wp_get_attachment_url( $image->ID, 'large' ); ?> " title="" >
            <?php echo wp_get_attachment_image($image->ID, 'singles_thumb', '' ,$imageclass); ?>
        </a>
    <?php endforeach; ?>
 <?php } ?>

```

Any ideas as to why fancybox is only working on the first gallery? Fancybox in my jQuery should be looking for different rel tags to start each gallery so I know I'm doubling up on that.