diff options
-rw-r--r-- | media/js/slideshow.js | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/media/js/slideshow.js b/media/js/slideshow.js index 227efdd..d1b2b93 100644 --- a/media/js/slideshow.js +++ b/media/js/slideshow.js @@ -77,15 +77,24 @@ $(document).ready(function(){ //Add navigation $('#breadcrumbs').after('<div id="slideshow-controls"><ul><li><a id="prev" title="you can also use the arrow keys to navigate" href="#"> ← Older</a></li><li><a id="play" title="Pause Slideshow" href="#">▐▐</a></li><li><a id="next" title="you can also use the arrow keys to navigate" href="#">Newer →</a></li></ul></div>'); + + //activate pause button - $('#play').toggle(function() { - $('#slides').cycle('pause'); - $(this).html('▶'); - $(this).attr('title','Play slideshow'); - }, function() { - $('#slides').cycle('resume', true); - $(this).html('▐▐'); - $(this).attr('title','Pause slideshow'); + //state var + var show_state = 'playing'; + $('#play').click(function() { + if (show_state == 'playing') { + $('#slides').cycle('pause'); + $(this).html('▶'); + $(this).attr('title','Play slideshow'); + show_state = 'paused'; + } else { + $('#slides').cycle('resume', true); + $(this).html('▐▐'); + $(this).attr('title','Pause slideshow'); + show_state= 'playing'; + } + return false; }); @@ -148,9 +157,7 @@ $(document).ready(function(){ //if this is a permalink, then pause: if(is_permalink == true) { - $('#slides').cycle('pause'); - $('#play').html('▶'); - $('#play').attr('title','Play slideshow'); + $('#play').click() } //callback to delete map and camera info windows if they exist function onBefore() { |