Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. <span id="rotator"></span>
  2.  
  3. var rotate = {
  4. quoteIndex: -1,
  5. duration: 500,
  6. delay: 3000,
  7. play: true,
  8. quotes: [],
  9. init: function (quotes) {
  10. this.quotes = quotes;
  11. this.showNextQuote();
  12. },
  13. showNextQuote: function () {
  14. this.quoteIndex = (this.quoteIndex + 1) % this.quotes.length;
  15. if (this.play) {
  16. $("#rotator").html(this.quotes[this.quoteIndex])
  17. .fadeIn(this.duration)
  18. .delay(this.delay)
  19. .fadeOut(this.duration, this.showNextQuote.bind(this));
  20. }
  21. },
  22. stop: function () {
  23. this.play = false;
  24. }
  25.  
  26.  
  27.  
  28. };
  29.  
  30. var test = rotate.init(["example1", "example2", "example3"]);
  31. test.stop();
  32.  
  33. var rotate = {
  34. quoteIndex: -1,
  35. duration: 500,
  36. delay: 3000,
  37. play: true,
  38. quotes: [],
  39. init: function (quotes) {
  40. this.quotes = quotes;
  41. this.showNextQuote();
  42. return this;
  43. },
  44. showNextQuote: function () {
  45. this.quoteIndex = (this.quoteIndex + 1) % this.quotes.length;
  46. if (this.play) {
  47. $("#rotator").html(this.quotes[this.quoteIndex])
  48. .fadeIn(this.duration)
  49. .delay(this.delay)
  50. .fadeOut(this.duration, this.showNextQuote.bind(this));
  51. }
  52. return this;
  53. },
  54. stop: function () {
  55. this.play = false;
  56. return this;
  57. }
  58.  
  59.  
  60.  
  61. };
  62.  
  63. var test = rotate.init(["example1", "example2", "example3"]);
  64. test.stop();
  65.  
  66. var rotate = {
  67. quoteIndex: -1,
  68. duration: 500,
  69. delay: 3000,
  70. play: true,
  71. quotes: [],
  72. init:function()
  73. {
  74. this.quotes = quotes;
  75. this.showNextQuote();
  76. return this;
  77. },
  78. showNextQuote: function () {
  79. //showNextQuote stuff.....
  80. },
  81. stop:function(){
  82. this.play = false;
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement