-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrotating-text.js
69 lines (30 loc) · 978 Bytes
/
rotating-text.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
/*
* Call function for rotating text
*/
(function($){
$.fn.rotate = function(params){
return this.each(function(index, el){
var defaults = {
text : [],
interval : 500
};
var options = $.extend({}, defaults, params);
var i = 0;
if(options.text.length){
setInterval(function(){
i = i < options.text.length -1 ? ++i : 0;
$(el).fadeOut(function(){
$(this).text(options.text[i]).fadeIn();
});
}, options.interval);
}
});
};
})(jQuery);
/*
* cahnge able text & delay intervals
*/
$("#rotate").rotate({
text : ['FLAT & CLEAN DESIGN', 'ONEPAGE PARALLAX', 'EASY TO CUSTOMIZE', '100% RESPONSIVE'],
interval : 5000 // in miliseconds
});