? views_cycle-cleaner_markup.patch
Index: views-cycle.tpl.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_cycle/views-cycle.tpl.php,v
retrieving revision 1.1.2.1
diff -u -p -r1.1.2.1 views-cycle.tpl.php
--- views-cycle.tpl.php	20 Apr 2009 21:53:59 -0000	1.1.2.1
+++ views-cycle.tpl.php	10 Jul 2009 05:32:48 -0000
@@ -9,4 +9,5 @@
       <li class="<?php print $classes[$id]; ?>"><?php print $row; ?></li>
     <?php endforeach; ?>
   </<?php print $options['type']; ?>>
+  <ul id='<?php print $cycle_id; ?>-thumb-data' style='display: none;'><?php print $thumbs_data; ?></ul>
 </div>
Index: views_cycle.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_cycle/views_cycle.js,v
retrieving revision 1.2.2.3
diff -u -p -r1.2.2.3 views_cycle.js
--- views_cycle.js	15 Jun 2009 20:13:26 -0000	1.2.2.3
+++ views_cycle.js	10 Jul 2009 05:32:48 -0000
@@ -32,7 +32,12 @@ Drupal.behaviors.viewsCycle = function(c
     // If thumbnails are used, this will always be how they're created.
     // Finds the thumbnail by the hidden div & id #.
     function makeAnchors(idx, slide) {
-      return Drupal.theme('viewsCycle', $("#view-cycle-thumb-"+idx).html(), "", idx);
+      // Get the cycle container and use it's id to select thumbs
+      parent_selector = "#"+$(slide).parent().attr('id')+"-thumb-data";
+      
+      thumb_item = $(parent_selector).children().eq(idx);
+      // Grab the thumbnail item's content and class names.
+      return Drupal.theme('viewsCycle', thumb_item.html(), thumb_item.attr('class'), idx);
     }
 
     // We can't set the function from PHP because we can't specify a datatype of
Index: views_cycle.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views_cycle/views_cycle.theme.inc,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 views_cycle.theme.inc
--- views_cycle.theme.inc	15 Jun 2009 20:13:26 -0000	1.1.2.4
+++ views_cycle.theme.inc	10 Jul 2009 05:32:48 -0000
@@ -44,6 +44,8 @@ function template_preprocess_views_cycle
   if ($options['thumbnail_field']) {
     // This is just a temporary hack.  See the note below.
     $keys = array_keys($view->field);
+    
+    // Grab each result row and add it to the thumbs list
     foreach ($view->result as $num => $row) {
       // This is wasteful, but necessary to make advanced_render() work.
       // See: http://drupal.org/node/444314
@@ -52,21 +54,21 @@ function template_preprocess_views_cycle
       foreach ($keys as $id) {
         $view->field[$id]->theme($row);
       }
-      for($i = 0; $i < count($rows); $i++) {
-        $classes = array();
-        if ($i == 0) {
-          $classes[] = 'views-cycle-first';
-        }
-        if ($i == (count($rows)-1)) {
-          $classes[] = 'views-cycle-last';
-        }
-        $classes[] = ($i % 2) ? "view-cycle-odd" : "view-cycle-even";
+      $classes = array();
+      if ($num == 0) {
+        $classes[] = 'view-cycle-first';
+      }
+      if ($num == (count($rows)-1)) {
+        $classes[] = 'view-cycle-last';
+      }
+      $classes[] = ($num % 2) ? "view-cycle-odd" : "view-cycle-even";
 
-        $classes = implode(' ', $classes);
+      $classes[] = "view-cycle-thumb-{$num}";
 
-        // Display by appending to the row.
-        $rows[$i] .= "<div id='view-cycle-thumb-{$num}' class='{$classes}' style='display: none'>". $view->render_field($options['thumbnail_field'], $num) ."</div>";
-      }
+      $classes = implode(' ', $classes);
+
+      // Append to the list items, which will later output in a single hidden list below the cycler.
+      $vars['thumbs_data'] .= "<li class='{$classes}' >". $view->render_field($options['thumbnail_field'], $num) ."</li>";
     }
     $settings['params']['pager']      = '#'. $vars['cycle_id'] .'-nav';
     $settings['use_pager_callback']   = 1;
