Go Back   CodingForums.com > :: Client side development > JavaScript programming > DOM and JSON scripting

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-20-2012, 06:53 PM   PM User | #1
clashboomband
New to the CF scene

 
Join Date: Sep 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
clashboomband is an unknown quantity at this point
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
clashboomband is offline   Reply With Quote
Old 09-20-2012, 07:18 PM   PM User | #2
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 945
Thanks: 7
Thanked 97 Times in 97 Posts
WolfShade is an unknown quantity at this point
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.
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
WolfShade is offline   Reply With Quote
Old 09-20-2012, 07:33 PM   PM User | #3
clashboomband
New to the CF scene

 
Join Date: Sep 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
clashboomband is an unknown quantity at this point
Quote:
Originally Posted by WolfShade View Post
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
clashboomband is offline   Reply With Quote
Old 09-20-2012, 07:37 PM   PM User | #4
WolfShade
Regular Coder

 
Join Date: Apr 2012
Location: St. Louis, MO, USA
Posts: 945
Thanks: 7
Thanked 97 Times in 97 Posts
WolfShade is an unknown quantity at this point
I think this is it. It's been a while. It does require jQuery.

http://srobbin.com/jquery-plugins/backstretch/
__________________
^_^

If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
*
The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".
WolfShade is offline   Reply With Quote
Reply

Bookmarks

Tags
fullscreen background, javascript, page load, randomized

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


Advertisement
Log in to turn off these ads.