I'm using the Fancybox-for-wordpress plugin along with infinite scroll. Can't seem to get fancybox to work on the second and third page with infinite scroll enabled. Anyone else ever come across this? Perhaps if there's a callback for fancybox after page 2 has loaded. Here's my infinite scroll script: <script type="text/javascript" src="/wp-content/themes/MagicAbacus/libs/jquery.infinitescroll.min2.js"></script> <script type="text/javascript"> // Infinite Scroll var href = 'first'; $(document).ready(function() { $('#boxes').infinitescroll({ navSelector : '.infinitescroll', nextSelector : '.infinitescroll a', itemSelector : '#boxes .box', loadingImg : '/wp-content/themes/MagicAbacus/images/loading.gif', loadingText : 'Loading...', donetext : 'No more pages to load.', debug : false }, function(arrayOfNewElems) { $('#boxes').masonry('appended', $(arrayOfNewElems)); if (href != $('.infinitescroll a').attr('href')) { href = $('.infinitescroll a').attr('href'); } }); }); </script> Code (markup):
I got it. Here's the script if anyone else has this problem: <script type="text/javascript" src="<?php bloginfo('template_url'); ?>/libs/jquery.infinitescroll.min.js"></script> <script type="text/javascript"> var href = 'first'; jQuery(document).ready(function($) { $("a[rel=lightbox], a[rel=lightboxTitle], a[rel=lightboxMore], a[rel=prev], a[rel=next]").live('click', function(){ $.fancybox({ 'type': 'ajax', 'hideOnOverlayClick': true, 'showNavArrows': true, 'href': $(this).attr('href') }); return false; }); $('#boxes').infinitescroll({ navSelector : '.infinitescroll', nextSelector : '.infinitescroll a', itemSelector : '#boxes .box', loadingImg : '<?php bloginfo('template_url'); ?>/images/loading.gif', loadingText : 'Loading...', donetext : 'No more pages to load.', debug : false }, function(arrayOfNewElems) { $('#boxes').masonry('appended', $(arrayOfNewElems)); if (href != $('.infinitescroll a').attr('href')) { href = $('.infinitescroll a').attr('href'); } }, function() { window.setTimeout(infinite_scroll_callback(), 1); } ); }); </script>