Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6254465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T14:11:02+00:00 2026-05-24T14:11:02+00:00

I have designed a sprite that looks like this: The idea is to have

  • 0

I have designed a sprite that looks like this:

enter image description here

The idea is to have the upper portion of the image fade in on hover (in a navigation system). I have everything working except for the text for the navigation items. As you can see on this page, the text for the navigation fades in and out with the background image, as it is contained within the span that is faded. I wonder if someone could help me get my head round how I can keep the text always showing.

Here is the html:

<ul class="navigation">
    <li><a href=""><span>home</span></a></li>
    <li><a href=""><span>contact</span></a></li>
</ul>

And the CSS:

body, ul,li { 
    margin:0;
    padding:0;
}

ul {
    list-style:none;
    text-align: center;
    color: white;
    line-height: 30px;
}

ul a {
    text-decoration: none;
    color: white;
    font-size: 18px;
}

.navigation li { 
    background: url(nav.png) no-repeat 0 -30px;
    width: 223px;
    height: 30px;
}

.navigation li span {
    background: url(nav.png) no-repeat 0 0px;
    width: 223px;
    height: 30px;
    display: block;
    opacity: 0;
    filter: alpha(opacity=0);
}

and the script:

$(document).ready(function() {
    $(".navigation li a").hover(function () {
        $(this).children("span").stop().animate({
            opacity: 1
        }, 300);
    }, function () {
        $(this).children("span").animate({
            opacity: 0
        }, 400);
    });
});

Thanks,

Nick

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T14:11:04+00:00Added an answer on May 24, 2026 at 2:11 pm

    This should do the trick. Live example: http://jsfiddle.net/zDwP9/2/

    HTML: (Moved span outside of a tag)

    <ul class="navigation">
        <li><a href="">home</a><span></span></li>
        <li><a href="">contact</a><span></span></li>
    </ul>
    

    CSS Changes: (Widened li, floated a left and span right, adjusted width and background position of span)

    ul a {
        text-decoration: none;
        color: white;
        font-size: 18px;
        float:left;
        width: 204px;
    }
    
    .navigation li span {
        background: url(nav.png) no-repeat -204px 0;
        width: 30px;
        height: 30px;
        display: block;
        opacity: 0;
        filter: alpha(opacity=0);
        float:right;
    }
    

    jQuery/JavaScript: (Changed selector from li a to li)

    $(document).ready(function() {
        $(".navigation li").hover(function () {
            $(this).children("span").stop().animate({
                opacity: 1
            }, 300);
        }, function () {
            $(this).children("span").animate({
                opacity: 0
            }, 400);
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have designed the following class that should work kind of like a method
I have designed a system that is made up of 3 separate applications: Web
I have designed a menu that consists of a few buttons in several different
I have designed this gui in netBeans which has a canvas , a couple
I have designed one sign-up form,in this form after getting all necessary values I
I have designed several animated Panel s in C# that all inherit from one
I have designed some classes using Visual Studio class diagramming. Now I would like
I have designed an input validation loop in C#, and I would like it
I have designed my database in such a way that One of my table
I have designed a webpage that can display properly in Windows XP (IE8) .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.