Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Adding value for changing animation speed

  • Loading branch information...
commit 827cd96d4e0c85537b74b4f579a856cbaef6ecd5 1 parent fbd85cc
David Pflug dpflug authored
Showing with 14 additions and 9 deletions.
  1. +1 −1  demo/index.html
  2. +3 −3 demo/multiple.html
  3. +10 −5 simpleSlideShow.js
2  demo/index.html
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>
6 demo/multiple.html
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>
15 simpleSlideShow.js
View
@@ -1,6 +1,8 @@
-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');
@@ -8,10 +10,10 @@ function simpleSlideShow(element, interval, next_element, prev_element, pause_el
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;
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.