Jquery Cycle and Fancybox

Jquery Cycle and Fancybox

I am trying to create a slideshow that uses the Jquery Cycle plugin. Inside each slide I would like to have images that open up to fancybox lightbox. The issue I'm having is that when the Cycle code is left alone, the images do not open nor do they even act like links. When I comment out the Cycle code, the images again become links and open the lightbox but it, as would be expected the slides are no longer slides. I'm new to Jquery so I appreciate any tips you can pass along.

Here is the code I'm using:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>

  4. <!-- FANCY BOX -->
  5. <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fancybox/1.3.4/jquery.fancybox-1.3.4.css" type="text/css" media="screen" />
  6.  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
  7. <script type="text/javascript">
  8.    var $jq = jQuery.noConflict();
  9. </script>
  10. <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/fancybox/1.3.4/jquery.fancybox-1.3.4.pack.js">        </script>

  11. <!-- JQUERY CYCLE -- >
  12. <!-- include jQuery library -->
  13. <!--<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>-->
  14. <!-- include Cycle plugin -->
  15. <script type="text/javascript" src="http://malsup.github.io/jquery.cycle.all.js"></script>

  16. <script type="text/javascript">
  17. jQuery(document).ready(function($) {
  18. var titles = $('#cycleContainer div.item').find("h2").map(function() { return    $(this).text(); });
  19. // Code that uses jQuery's $ can follow here.
  20. $('#cycleContainer').before('<div id="current_resident_nav"></li><ul id="pager"><li> <h2>artists</h2></ul></div>').cycle({
  21. //Specify options
  22. fx:     'scrollLeft', //Name of transition effect
  23. timeout: 0,           //Disable auto advance
  24. pager:  '#pager',     //Selector for element to use as pager container
  25. pagerAnchorBuilder: function (index) {               //Build the pager
  26. return '<li><p class="artists"><a href="#">' + titles[index] + '</p></a></li>';
  27. },
  28. updateActivePagerLink: function(pager, currSlideIndex) {
  29. $(pager).find('li').removeClass('active').filter('li:eq('+currSlideIndex+')').addClass('active');
  30. }
  31. });
  32. });

  33. </script>
  34. <script type="text/javascript">
  35. jQuery(document).ready(function($) {
  36. $jq("a.example_group").fancybox({
  37.         'transitionIn'      : 'none',
  38.         'transitionOut'     : 'none',
  39.         'titlePosition'     : 'over',
  40.         'titleFormat'       : function(title, currentArray, currentIndex, currentOpts) {
  41.             return '<span id="fancybox-title-over">Image ' + (currentIndex + 1) + ' / ' + currentArray.length + (title.length ? ' &nbsp; ' + title : '') + '</span>';
  42.         }
  43.     });

  44. });

  45. </script>



  46. <title>Tech Demo</title>
  47. </head>

  48. <body>
  49. <div id="cycleContainer" style="z-index: -100;">   
  50. <div class="item">
  51. <div id="current_resident_content" style="border:1px solid black; width: 960px; height: 500px;">
  52.                     <div id="current_resident_images">
  53.                         <div class="current_resident_img"><a class="example_group" rel="group1" href="http://cdn4.blogs.babble.com/strollerderby/files/2011/06/test-100x100.jpg"><img src="http://cdn4.blogs.babble.com/strollerderby/files/2011/06/test-100x100.jpg" width=100 height=100 /></a></div>

  54.                         <div class="current_resident_img"><a class="example_group" rel="group1" href="http://www.newyorker.com/online/blogs/alpha/test/test-thumb-100x100.jpg"><img src="http://www.newyorker.com/online/blogs/alpha/test/test-thumb-100x100.jpg" width=100 height=100 /></a></div>

  55.                         <div class="current_resident_img"><img src="{resident-thumbnail-3}" width=100 height=100 /></div>

  56.                         <div class="current_resident_img"><img src="{resident-thumbnail-4}" width=100 height=100 /></div>

  57.                         <div class="current_resident_img"><img src="{resident-thumbnail-5}" width=100 height=100 /></div>

  58.                     </div><br />
  59.                     <div id="current_resident_bio">
  60.                                 <h2>This is a test</h2>
  61.                                     <p>Lorem Ipsum blah blah blah</p>                               

  62.                     </div>
  63.                 </div>


  64. </div>
  65. <div class="item">
  66. <div id="current_resident_content" style="border:1px solid black; width: 960px; height: 500px;">
  67.                     <div id="current_resident_images">
  68.                         <div class="current_resident_img"><a class="example_group" rel="group2" href="http://www.fmwconcepts.com/misc_tests/caption_test/1tmp_6819.gif"><img src="http://www.fmwconcepts.com/misc_tests/caption_test/1tmp_6819.gif" width=100 height=100 /></a></div>

  69.                         <div class="current_resident_img"><a class="example_group" rel="group2" href="http://www.nasa.gov/centers/marshall/images/content/99076main_DSCF8603_t.jpg"><img src="http://www.nasa.gov/centers/marshall/images/content/99076main_DSCF8603_t.jpg" width=100 height=100 /></a></div>

  70.                         <div class="current_resident_img"><img src="{resident-thumbnail-3}" width=100 height=100 /></div>

  71.                         <div class="current_resident_img"><img src="{resident-thumbnail-4}" width=100 height=100 /></div>

  72.                         <div class="current_resident_img"><img src="{resident-thumbnail-5}" width=100 height=100 /></div>

  73.                     </div><br />
  74.                     <div id="current_resident_bio">
  75.                                 <h2>This is a test</h2>
  76.                                     <p>Lorem Ipsum blah blah blah</p>                               

  77.                     </div>
  78.                 </div>


  79. </div>
  80. </div>
  81. </body>
  82. </html>