Results 1 to 2 of 2

Thread: CSS Navbar rollover image problem

  1. #1
    texas is offline New Member: Posts Will Be Moderated
    Join Date
    Jun 2011
    Posts
    1

    CSS Navbar rollover image problem

    Please can someone help me, I have created a navbar using CSS roll over images, but when you first open the browser and hover over the nav menu the images will go blank for a second before being replaced by the image roll over.

    I have used the body onload function but it doesn't seem to work, please does anyone have any ideas?

    CSS

    #btn-home {
    background-image:url(http://www.terrypowell.co.uk/images/...e-normal.gif);
    background-repeat:no-repeat no-repeat;
    display:block;
    height:50px;
    left:390px;
    position:absolute;
    top:80px;
    width:77px;
    }
    #btn-home:hover {
    background-image:url(http://www.terrypowell.co.uk/images/btn-home-over.gif);
    background-repeat:no-repeat no-repeat;
    display:block;
    height:50px;
    left:390px;
    position:absolute;
    top:80px;
    width:77px;
    }
    #btn-about {
    background-image:url(http://www.terrypowell.co.uk/images/...t-normal.gif);
    background-repeat:no-repeat no-repeat;
    display:block;
    height:50px;
    left:467px;
    position:absolute;
    top:80px;
    width:114px;
    }
    #btn-about:hover {
    background-image:url(http://www.terrypowell.co.uk/images/...out-over.gif);
    background-repeat:no-repeat no-repeat;
    display:block;
    height:50px;
    left:467px;
    position:absolute;
    top:80px;
    width:114px;
    }
    #btn-portfolio {
    background-image:url(http://www.terrypowell.co.uk/images/btn-portfolio.gif);
    background-repeat:no-repeat no-repeat;
    display:block;
    height:50px;
    left:581px;
    position:absolute;
    top:80px;
    width:92px;
    }
    #btn-portfolio:hover {
    background-image:url(http://www.terrypowell.co.uk/images/...lio-over.gif);
    background-repeat:no-repeat no-repeat;
    display:block;
    height:50px;
    left:581px;
    position:absolute;
    top:80px;
    width:92px;
    }
    #btn-contact {
    background-image:url(http://www.terrypowell.co.uk/images/...t-normal.gif);
    background-repeat:no-repeat no-repeat;
    display:block;
    height:50px;
    left:673px;
    position:absolute;
    top:80px;
    width:97px;
    }
    #btn-contact:hover {
    background-image:url(http://www.terrypowell.co.uk/images/...act-over.gif);
    background-repeat:no-repeat no-repeat;
    display:block;
    height:50px;
    left:673px;
    position:absolute;
    top:80px;
    width:97px;
    }


    HTML

    <body onload="MM_preloadImages('images/btn-home-over.gif','images/btn-about-over.gif','images/btn-portfolio-over.gif','images/btn-contact-over.gif')">


    <div id="mainContainer"> <!-- start main container -->

    <div id="header"> <!-- start header-->

    <div id="header-top"></div>
    <a id="btn-terry" href="index.html" title="Click here to return to the homepage"></a>
    <div id="slogan"> </div>
    <a id ="btn-home" href="index.html" title="Home"></a>
    <a id ="btn-about" href="about-terry-powell.html" title="About Terry"></a>
    <a id ="btn-portfolio" href="terry-powell-portfolio.html" title="Portfolio"></a>
    <a id ="btn-contact" href="contact-terry-powell.html" title="Contact"></a>

    </div> <!-- end header -->

  2. #2
    Join Date
    Jun 2007
    Posts
    295
    One thing that might help is to use a sprite. It's where you combine your regular and "hover" image into one image (usually stacked on top of each other. Then, in the css, you use "background-position" to move the background image on a hover. This way there will not be the flicker.

    As for your question as hand, do you have the function MM_preloadImages() defined in your webpage? I know it's a dreamweaver function, but sometimes dreamweaver forgets to add it (if you undo or something like that).

Similar Threads

  1. css navbar problem in aol browser
    By AdamSayer in forum Web Design, HTML Reference and CSS
    Replies: 0
    Last Post: 04 Apr 2008, 11:03 AM

Posting Permissions

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