SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Navigation Problem - Better Solution?

    Hi guys,

    I have a problem with navigation on my webpage. I use images for normal state of button and hover/active state. When I hover my button on page (when its online) there is a blank hole but when I hover it again right image shows up (like it waits for loading).

    Can you please tell me how to fix that because its all okay on localhost but on online server is something wrong.
    Also if you have better way to create navigation could you please tell me?

    (X)HTML:
    HTML Code:
    <div id="header">
        <a href="index.html"><img src="images/logo.png" /></a>
        <ul id="navigation">
            <li><a href="index.html" class="homeActive"></a></li>
            <li><a href="about.html" class="about"></a></li>
            <li><a href="score.html" class="score"></a></li>
            <li><a href="gallery.html" class="gallery"></a></li>
            <li><a href="contact.html" class="contact"></a></li>
        </ul>
    </div>
    CSS:
    HTML Code:
    #navigation {
    	float:right;
    	list-style:none;
    	margin:20px 20px 0 0;
    }
    
    #navigation li {
    	float:left;
    	margin-left:10px;
    }
    
    .home, .about, .score, .gallery, .contact, .homeActive, .aboutActive, .scoreActive, .galleryActive, .contactActive {
    	width:80px;
    	height:20px;
    	display:block;
    }
    
    .home { background:url(images/home.png); }
    .homeActive, .home:hover { background:url(images/homeActive.png); }
    .about { background:url(images/about.png); }
    .aboutActive, .about:hover { background:url(images/aboutActive.png); }
    .score { background:url(images/score.png); }
    .scoreActive, .score:hover { background:url(images/scoreActive.png); }
    .gallery { background:url(images/gallery.png); }
    .galleryActive, .gallery:hover { background:url(images/galleryActive.png); }
    .contact { background:url(images/contact.png); }
    .contactActive, .contact:hover { background:url(images/contactActive.png); }
    Thanks!

  2. #2
    SitePoint Wizard bronze trophy PicnicTutorials's Avatar
    Join Date
    Dec 2007
    Location
    Carlsbad, California, United States
    Posts
    3,658
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)
    Hello, thats happening because the browser takes a sec to load the new image. To get rid of that you'll need to either use a sprites navigation, or preload the images. I've never seen how successful or not preloading is. Here is a sprites way... http://www.visibilityinherit.com/code/sprites.php

  3. #3
    SitePoint Member
    Join Date
    Jul 2009
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks man thats helps a lot!


Bookmarks

Posting Permissions

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