Permalink
Browse files

Adding value for changing animation speed

  • Loading branch information...
1 parent fbd85cc commit 827cd96d4e0c85537b74b4f579a856cbaef6ecd5 @dpflug dpflug committed Jun 14, 2011
Showing with 14 additions and 9 deletions.
  1. +1 −1 demo/index.html
  2. +3 −3 demo/multiple.html
  3. +10 −5 simpleSlideShow.js
View
@@ -18,7 +18,7 @@
</head>
<script type="text/javascript">
$(document).ready(function() {
- simpleSlideShow('#slideshow',5000,'#slideshow_next','#slideshow_prev', '#slideshow_pause', '#slideshow_play');
+ simpleSlideShow('#slideshow',5000,2000,'#slideshow_next','#slideshow_prev', '#slideshow_pause', '#slideshow_play');
});
</script>
<body>
View
@@ -21,9 +21,9 @@
</head>
<script type="text/javascript">
$(document).ready(function() {
- simpleSlideShow('#slideshow1',1000,'#slideshow1_next','#slideshow1_prev', '#slideshow1_pause', '#slideshow1_play');
- simpleSlideShow('#slideshow2',5000,'#slideshow2_next','#slideshow2_prev');
- simpleSlideShow('#slideshow3',false,'#slideshow3_next','#slideshow3_prev');
+ simpleSlideShow('#slideshow1',1000,500,'#slideshow1_next','#slideshow1_prev', '#slideshow1_pause', '#slideshow1_play');
+ simpleSlideShow('#slideshow2',5000,1000,'#slideshow2_next','#slideshow2_prev');
+ simpleSlideShow('#slideshow3',false,2000,'#slideshow3_next','#slideshow3_prev');
});
</script>
<body>
View
@@ -1,17 +1,19 @@
-function simpleSlideShow(element, interval, next_element, prev_element, pause_element, play_element) {
+function simpleSlideShow(element, interval, slidetimer, next_element, prev_element, pause_element, play_element) {
+ console.log("Initializing simpleSlideShow")
var slideshow_next = function(el) {
+ console.log("This is a test.")
var $el = $(el);
if ($el.data('locked') == 'False') {
$el.data('locked', 'True');
var $previous = $el.children(':first');
var $active = $previous.next();
$active.animate({
left: '0%'
- }, 2000);
+ }, slidetimer);
$previous.animate({
left: '-' + ss_width
- }, 2000, function() {
+ }, slidetimer, function() {
$previous.css('left', ss_width);
$previous.appendTo($el);
$el.data('locked', 'False');
@@ -29,10 +31,10 @@ function simpleSlideShow(element, interval, next_element, prev_element, pause_el
$active.css('left', '-' + ss_width);
$next.animate({
left: ss_width
- }, 2000);
+ }, slidetimer);
$active.animate({
left: '0%'
- }, 2000, function() {
+ }, slidetimer, function() {
$el.data('locked', 'False');
});
}
@@ -83,4 +85,7 @@ function simpleSlideShow(element, interval, next_element, prev_element, pause_el
if (play_element !== undefined) {
$(play_element).click(function(){slideshow_play()});
}
+ if (slidetimer === undefined) {
+ slidetimer = 2000;
+ }
}

0 comments on commit 827cd96

Please sign in to comment.