docs: add the ability to pause the carousel

Change-Id: I1ffc929cf93217b578397d825e1eb41369d2666c
This commit is contained in:
Scott Main
2013-01-14 19:03:40 -08:00
parent 869f3d1f68
commit eb41035fcf
3 changed files with 24 additions and 1 deletions

View File

@@ -1138,6 +1138,9 @@ td {
background-color:inherit; background-color:inherit;
border:solid 1px #DDD; border:solid 1px #DDD;
} }
td *:last-child {
margin-bottom:0;
}
th { th {
background-color: #999; background-color: #999;
color: #fff; color: #fff;

View File

@@ -1144,6 +1144,7 @@ function hideExpandable(ids) {
* Options: * Options:
* btnPrev: optional identifier for previous button * btnPrev: optional identifier for previous button
* btnNext: optional identifier for next button * btnNext: optional identifier for next button
* btnPause: optional identifier for pause button
* auto: whether or not to auto-proceed * auto: whether or not to auto-proceed
* speed: animation speed * speed: animation speed
* autoTime: time between auto-rotation * autoTime: time between auto-rotation
@@ -1161,6 +1162,7 @@ function hideExpandable(ids) {
o = $.extend({ o = $.extend({
btnPrev: null, btnPrev: null,
btnNext: null, btnNext: null,
btnPause: null,
auto: true, auto: true,
speed: 500, speed: 500,
autoTime: 12000, autoTime: 12000,
@@ -1232,6 +1234,17 @@ function hideExpandable(ids) {
return go(curr+o.scroll); return go(curr+o.scroll);
}); });
//Pause button
if(o.btnPause)
$(o.btnPause).click(function(e) {
e.preventDefault();
if ($(this).hasClass('paused')) {
startRotateTimer();
} else {
pauseRotateTimer();
}
});
//Auto rotation //Auto rotation
if(o.auto) startRotateTimer(); if(o.auto) startRotateTimer();
@@ -1244,6 +1257,12 @@ function hideExpandable(ids) {
go(curr+o.scroll); go(curr+o.scroll);
} }
}, o.autoTime); }, o.autoTime);
$(o.btnPause).removeClass('paused');
}
function pauseRotateTimer() {
clearInterval(timer);
$(o.btnPause).addClass('paused');
} }
//Go to an item //Go to an item

View File

@@ -29,7 +29,8 @@ window.gOverride = {
<script type="text/javascript"> <script type="text/javascript">
$('.slideshow-container').dacSlideshow({ $('.slideshow-container').dacSlideshow({
btnPrev: '.slideshow-prev', btnPrev: '.slideshow-prev',
btnNext: '.slideshow-next' btnNext: '.slideshow-next',
btnPause: '#pauseButton'
}); });
</script> </script>
<?cs /if ?> <?cs /if ?>