Advertisement
Guest User

Untitled

a guest
Feb 13th, 2016
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.  
  5. <meta charset="utf-8">
  6. <title>My SATX</title>
  7. <style>
  8. .quote-rotate {
  9. display: inline-block;
  10. padding: 5px 10px 5px 10px;
  11. position: relative;
  12. left: 30%;
  13. font-style: italic;
  14. font-size: 2rem;
  15. }
  16. </style>
  17.  
  18. </head>
  19. <body>
  20.  
  21. <p class="quote-rotate"><span id="rotate"></span></p>
  22.  
  23. <script src="/js/jquery.js"></script>
  24.  
  25. <script>
  26. "use strict";
  27. $(document).ready(function() {
  28.  
  29. var quotesSA = ["Love San Antonio!", "Great place to visit...", "Beautiful city!"];
  30.  
  31. function rotateTerm() {
  32. var currentTerm = $("#rotate").data("quotesSA") || 0; // get current term, defaulting to 0 if there is no current term
  33. $("#rotate") // find element with id="rotate"
  34. .data("quotesSA", currentTerm == quotesSA.length - 1 ? 0 : currentTerm + 1) //store next term, looping to the beginning of the array as necessary
  35. .text(quotesSA[currentTerm]) // set the text of the span
  36. .fadeIn() // fade the element in from full transparency
  37. .delay(2000) // wait 2 seconds
  38. .fadeOut(200, rotateTerm); // fade the element out to full transparency and call this function again
  39. }
  40. $(rotateTerm);
  41. });
  42.  
  43. </script>
  44.  
  45. </body>
  46. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement