jQuery Nivo Slider and prettyPhoto issues

jQuery Nivo Slider and prettyPhoto issues

For a Wordpress site i'm developing i'm using the Nivo Slider and prettyPhoto jQuery plugins. However, i cannot seem to get these 2 to work properly together.

Here's the thing i'm trying to do: I've made a custom WP Loop to get 5 posts out of a category, and display them in the Nivo Slider. I take the post title and the excerpt, but them in a PHP Array, and put these into the Nivo Slider caption. The post title, that's displayed in the caption, links to a youtube video and should fire off prettyPhoto. I've used the rel="prettyPhoto" for this. But here comes the problem. prettyPhoto only works on the first slide, the first time it is displayed. As soon as the slider animates towards another slide, prettyPhoto stops working and the caption link just sends me to a youtube page.

I've enqueued both scripts using Wordpress' functions.php, so they're all placed in the footer. jQuery itself is placed in the header, WP does this automatically. WordPress also puts jQuery in no conflict mode, if it wouldn't prettyPhoto wouldn't work at all, not even on the first slide.

The site can be viewed here: http://ijstapijt.nl/wp_test/

The WordPress loop for the slider & prettyPhoto:
  1. <div id="headline_slider_container">
  2.    <div id="headline_slider" class="nivoSlider">            
  3.                 
  4.  <!-- Wordpress Loop voor de Nivo Slider -->
  5.  <?php
  6.  $captions = array();
  7.  $my_query = new WP_Query('showposts=5&category_name=videos');
  8.  while ($my_query->have_posts()) : $my_query->the_post();
  9.  $captions[] = '<a rel="prettyPhoto" class="caption_links" href="'.get_field("youtube").'" title="'.get_the_title($post->ID).'">'.get_the_title($post->ID).'</a><p class="headlinecaption">'.get_the_excerpt().'<a class="headlinecaption" href="'.get_permalink($post->ID).'">Lees Meer</a></p>';
  10.  ?>
  11.  <a rel="prettyPhoto" href="<?php the_field('youtube'); ?>"><img src="<?php the_field('nivoimage'); ?>" alt="<?php the_title_attribute(); ?>" title="#caption<?php echo count($captions)-1; ?>" /></a>
  12.  <?php endwhile; ?>
  13.  <!-- Einde WP Loop -->
  14.    </div>
  15.             
  16.    <!-- plaats caption array in de div id #caption -->
  17.             <?php foreach($captions as $key => $caption) : ?>
  18.             <div id="caption<?php echo $key; ?>" class="nivo-html-caption">
  19.                 <?php echo $caption; ?>
  20.             </div>
  21.             <?php endforeach; ?>