diff options
Diffstat (limited to 'media/js/slideshow.js')
-rw-r--r-- | media/js/slideshow.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/media/js/slideshow.js b/media/js/slideshow.js index 7ada1c5..c889621 100644 --- a/media/js/slideshow.js +++ b/media/js/slideshow.js @@ -103,10 +103,16 @@ $(document).ready(function(){ $('#slides').append('<div class="slidenav"><a id="prev">< Prev </a><a id="next"> Next ></a></div>'); $('.slidenav').css("display","none"); - + //find out if we should display a specific slide + var index = 0, hash = window.location.hash; + if (hash) { + index = /\d+/.exec(hash)[0]; + index = (parseInt(index) || 1) - 1; // slides are zero-based + } // initialize the cycle slideshow $('#slides .bigimg').wrapAll('<div class="bigimgs">').parents('#slides').append('<ul class="menu" id="feature_gallery_pager">').cycle({ fx: 'fade', + startingSlide: index, pause: 1, prev: '#prev', next: '#next', @@ -128,14 +134,14 @@ $(document).ready(function(){ //callback to change url for permalinks and scroll jcarousel function onAfter(curr,next,opts) { - window.location.hash = 'image'+(opts.currSlide + 1); if (opts.currSlide % 10 == 0) { if (opts.currSlide != 0) { $('#slides').trigger('image-loaded',[opts.currSlide+1]); } else { $('#slides').trigger('image-loaded',[1]); } - } + } + window.location.hash = 'image'+(opts.currSlide + 1); } //callback for jcarousel |