CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   DOM and JSON scripting (http://www.codingforums.com/forumdisplay.php?f=15)
-   -   Randomized background on refresh (http://www.codingforums.com/showthread.php?t=273690)

clashboomband 09-20-2012 06:53 PM

Randomized background on refresh
 
Hi there,

I'm currently using a javascript for randomized background image on page refresh however, I need the background image to be full screen and resizable on browser resize.

I'm using this script as below:

<script type="text/javascript">
var totalCount = 8;
function ChangeIt()
{
var num = Math.ceil( Math.random() * totalCount );
document.body.background = 'bgimages/'+num+'.jpg';
document.body.style.backgroundRepeat = "repeat";// Background repeat
}
</script>


What do I have to add in document.write any ideas? I would also need it to work across all browsers and mobile platform. If this doesn't work any Jquery or HTML5 tutorials on this? Please help! Thanks much :)

WolfShade 09-20-2012 07:18 PM

I don't have the link to it, now, but there is a library that you can use to make the background image full size and scalable with browser size changes.

clashboomband 09-20-2012 07:33 PM

Quote:

Originally Posted by WolfShade (Post 1271820)
I don't have the link to it, now, but there is a library that you can use to make the background image full size and scalable with browser size changes.

please let me have the link when u do. that would really help. appreciate it! Thank you :)

WolfShade 09-20-2012 07:37 PM

I think this is it. It's been a while. It does require jQuery.

http://srobbin.com/jquery-plugins/backstretch/


All times are GMT +1. The time now is 02:28 AM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.