Cycle: Start the slideshow from the thumbnail image clicked on
I' have a masonry thumbnail gallery, and the thumbnails link to a jQuery Cycle slideshow. Originally, whatever thumbnail you click on the slideshow starts with the first slide. I'd like to make it so when you click on a thumbnail, it goes to the slideshow starting with that thumbnail image. I'm trying "startingSlide" option of Cycle. Also, the site is built with Wordpress.
This is in my thumbnail gallery template:
- <div class="m_item">
- <a href="http://paraboladesignstudio.ipage.com/yahaira/fashion/fashion-slideshow/?thumb=1">
- <img src="<?php echo $image['url'];?>" title="<?php echo $image['title'];?>" alt="<?php echo $image['alt']; ?>">
- </a>
- </div>
And this in my slideshow template:
- <ul class="slideshow">
- <?php
- $thumb = $_GET["thumb"];
- $firstImage = $images[$thumb-1];
- //echo first image here
- for($i = 0; $i < count($images); $i++):
- if($i == ($thumb-1)) continue;
- $image = $images[$i];
- ?>
- <li>
- <table>
- <tr>
- <td>
- <div class="slideshow_image" data-startingslide="<?php echo $thumb; ?>"><img src="<?php echo $image['url'];?>" alt="<?php echo $image['alt']; ?>"></div>
- </td>
- </tr>
- </table>
- </li>
- <?php endfor; ?>
- </ul>
And this in my javascript file:
- var startingSlide = $('.slideshow_image').data('startingslide');
- $(slideshowContainer).cycle ({
- fx: slideshowFx,
- delay: slideshowDelay,
- speed: slideshowSpeed,
- timeout: slideshowTimeout,
- containerResize: 0,
- startingSlide: startingSlide,
- fit: 0,
- slideResize: 0,
- height: _h,
- width: _w,
- cleartype: true,
- cleartypeNoBg: true,
- next: slideshowNextBtn,
- prev: slideshowPrevBtn,
- before: function(curr, next, opts) {
- $(slideshowShareLink).removeClass('sel');
- $(slideshowShareContainer).css({'visibility':'hidden'});
- preLoadImage(opts.currSlide, opts.slideCount);
- $('.slideshow_title').html($(next).data('title'));
- },
- after: function(curr,next,opts) {
- onAfter(curr,next,opts);
- }
- });