Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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

  • #2
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    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".

  • #3
    New to the CF scene
    Join Date
    Sep 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    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".


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •