texas
11 Jun 2011, 05:07 AM
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/btn-home-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/btn-about-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/btn-about-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/btn-portfolio-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/btn-contact-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/btn-contact-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 -->
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/btn-home-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/btn-about-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/btn-about-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/btn-portfolio-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/btn-contact-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/btn-contact-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 -->