Im using this script that I found online to have a random background image every time I refresh the browser.
CSS
body{ background: no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; }
Js
$(document).ready(function(){ var images=['images/001.jpg', 'images/002.jpg', 'images/003.jpg', 'images/004.jpg', 'images/005.jpg',]; var randomNumber = Math.floor(Math.random() * images.length); var bgImg = 'url(' + images[randomNumber] + ')'; $('body').css({'background':bgImg, 'background-size':'cover', }); });
Works great on screens larger than 1150 pixels, but least of all, images begin to accumulate one on top of the other. How can I make it stretch regardless of screen size. I don't care if the image is cropped on small screens while it fills the lot.
thanks
no0ne source share