Advertisement
vedranvinko

random background

Jul 12th, 2015
350
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
CSS 0.23 KB | None | 0 0
  1. $(document).ready(function() {
  2.     var images = ['bg1.jpg', 'bg2.jpg', 'bg3.jpg', 'bg4.jpg', 'bg5.jpg', 'bg6.jpg'];
  3.     $('body').css({'background-image': 'url(images/' + images[Math.floor(Math.random() * images.length)] + ')'});
  4. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement