-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathras.auto.js
55 lines (40 loc) · 1.3 KB
/
ras.auto.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* [URL] */
;(function($, window, document, undefined) {
var r = $.ras.slideshow;
r.autoslide = {
options : {
time:2000,
textPlay:'play',
textPause:'pause',
duration:700
}
};
$.fn.autoslide = function(options) {
options = $.extend({}, r.autoslide.options, options);
return this.each(function(){
var slideshow = $(this),
parentSlideshow = $(this).parent().parent(),
navAutoSlide = '<button id="playRas">'+options.textPlay+'</button><button id="stopRas">'+options.textPause+'</button>',
navRas = parentSlideshow.find('#navRAS');
navRas.append(navAutoSlide);
var playBtn = navRas.find('#playRas'),
stopBtn = navRas.find('#stopRas')
stopFct = function() {
autoSlideShow = clearInterval(autoSlideShow);
};
playFct = function() {
autoSlideShow = setInterval(function(){$.fn.ras.slide(slideshow, 'next', options.duration)}, options.time);
};
//Slide
playFct();
//button to slide
playBtn.bind('click', function(){
playFct();
});
//button to stop slide
stopBtn.bind('click', function(){
stopFct();
});
});
};
})(jQuery, window, document);