fnp
/
prawokultury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Handling special case with zero clicks
[prawokultury.git]
/
prawokultury
/
static
/
js
/
promobox.js
diff --git
a/prawokultury/static/js/promobox.js
b/prawokultury/static/js/promobox.js
index
91128ca
..
760c10b
100644
(file)
--- a/
prawokultury/static/js/promobox.js
+++ b/
prawokultury/static/js/promobox.js
@@
-17,24
+17,29
@@
var change_slide = function(slide_no) {
};
};
-$switchers.each(function(i, e) {
- $(e).click(function(e) {
- e.preventDefault();
- change_slide(i);
- });
-});
-
-
var timeout = null;
var cycle_slide = function() {
var current = $slides.filter('.active').index();
change_slide((current + 1) % $slides.length);
}
var timeout = null;
var cycle_slide = function() {
var current = $slides.filter('.active').index();
change_slide((current + 1) % $slides.length);
}
+
+
var reset_timeout = function() {
clearTimeout(timeout);
timeout = setTimeout(cycle_slide, 5000);
};
var reset_timeout = function() {
clearTimeout(timeout);
timeout = setTimeout(cycle_slide, 5000);
};
-timeout = setTimeout(cycle_slide, 3000);
+
+
+if ($slides.length > 1) {
+ $switchers.each(function(i, e) {
+ $(e).click(function(e) {
+ e.preventDefault();
+ change_slide(i);
+ });
+ });
+
+ timeout = setTimeout(cycle_slide, 3000);
+}
});
\ No newline at end of file
});
\ No newline at end of file