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 2 of 2
  1. #1
    Regular Coder
    Join Date
    Jan 2013
    Location
    Australia
    Posts
    109
    Thanks
    21
    Thanked 0 Times in 0 Posts

    Cool JS Background Help

    Hello I have a slight problem with code that have been trying to work out when my images load up in back ground the first image is plain white doesn't start at first image. www.mwbcomputers.com.au and flickers funny

    <script language="javascript">
    // Super descriptive variable names!!!
    var a = self.setInterval('roastBeef()', 4000);
    var b = 0;
    var c = [
    'http://mwbcomputers.com.au/catalog/view/theme/mwbcomputers/image/bg1.png',
    'http://mwbcomputers.com.au/catalog/view/theme/mwbcomputers/image/bg2.png',
    ];

    // I shouldn't have used these massive background images!!!
    function roastBeef(){
    b = (b+1) % c.length ;
    return $('body').css('background', 'url("' + c[b] + '") no-repeat center center fixed');
    }
    </script>

  • #2
    Regular Coder ArcticFox's Avatar
    Join Date
    Jan 2004
    Location
    Vostok Station, AQ
    Posts
    602
    Thanks
    35
    Thanked 3 Times in 3 Posts
    Flicker is caused by "fixed". The huge file size probably doesn't help, especially on slower computers (like mine) and/or older video cards.
    <div> - putting your mind in a box since 1997


  •  

    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
    •