Created
          January 6, 2018 11:10 
        
      - 
      
 - 
        
Save TheBeachMaster/1a2b6f45accb81ba7cabb45d04c13367 to your computer and use it in GitHub Desktop.  
    The text presentation on my personal website
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | // Requires JQuery 3+ | |
| var quotes = [ | |
| " for a better world", | |
| " for food", | |
| " for fun", | |
| " for the communinity", | |
| " to empower people", | |
| " to keep my job", | |
| " to keep out of trouble", | |
| " to get shit done", | |
| " because I can 😎" | |
| ]; | |
| // variable to keep track of last quote displayed | |
| var i = 0; | |
| // displays the next quote in the array | |
| var quoteTimer = function() { | |
| // if at end of array, reset | |
| if (i >= quotes.length) { | |
| i = 0; | |
| } | |
| // fade out previous quote, | |
| // while hidden, change the text to the next quote on the array | |
| $('#reason').fadeOut(1000, function() { | |
| $(this).text(quotes[i]); | |
| }); | |
| // display the quote | |
| $('#reason').fadeIn(); | |
| // increment counter by one | |
| i++; | |
| } | |
| // have an HTML element with ID reason or something else | |
| $(document).ready(function() { | |
| $('#reason').text(quotes[i++]); // initialize with first quote | |
| // var reason = document.getElementById("reason"); | |
| setInterval(quoteTimer, 2000); | |
| }); | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment