Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
  2.     <script>
  3.         var work = $('body');
  4.  
  5.         var backgroundUrls = [
  6.             'img/contentbackground1.jpg',
  7.             'img/contentbackground2.jpg',
  8.             'img/contentbackground3.jpg',
  9.             'img/contentbackground4.jpg'
  10.         ];
  11.        
  12.         var currentBackgroundIndex = 0;
  13.  
  14.         function setNextBackground () {
  15.             work.css('background-image', 'url(' + backgrounds[currentBackgroundIndex] + ')');
  16.             currentBackgroundIndex++;
  17.         }
  18.  
  19.         setNextBackground();
  20.         setInterval(currentBackgroundIndex, 1000);
  21.        
  22.     </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement