Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <span id="rotator"></span>
- var rotate = {
- quoteIndex: -1,
- duration: 500,
- delay: 3000,
- play: true,
- quotes: [],
- init: function (quotes) {
- this.quotes = quotes;
- this.showNextQuote();
- },
- showNextQuote: function () {
- this.quoteIndex = (this.quoteIndex + 1) % this.quotes.length;
- if (this.play) {
- $("#rotator").html(this.quotes[this.quoteIndex])
- .fadeIn(this.duration)
- .delay(this.delay)
- .fadeOut(this.duration, this.showNextQuote.bind(this));
- }
- },
- stop: function () {
- this.play = false;
- }
- };
- var test = rotate.init(["example1", "example2", "example3"]);
- test.stop();
- var rotate = {
- quoteIndex: -1,
- duration: 500,
- delay: 3000,
- play: true,
- quotes: [],
- init: function (quotes) {
- this.quotes = quotes;
- this.showNextQuote();
- return this;
- },
- showNextQuote: function () {
- this.quoteIndex = (this.quoteIndex + 1) % this.quotes.length;
- if (this.play) {
- $("#rotator").html(this.quotes[this.quoteIndex])
- .fadeIn(this.duration)
- .delay(this.delay)
- .fadeOut(this.duration, this.showNextQuote.bind(this));
- }
- return this;
- },
- stop: function () {
- this.play = false;
- return this;
- }
- };
- var test = rotate.init(["example1", "example2", "example3"]);
- test.stop();
- var rotate = {
- quoteIndex: -1,
- duration: 500,
- delay: 3000,
- play: true,
- quotes: [],
- init:function()
- {
- this.quotes = quotes;
- this.showNextQuote();
- return this;
- },
- showNextQuote: function () {
- //showNextQuote stuff.....
- },
- stop:function(){
- this.play = false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement