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 6742889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:53:47+00:00 2026-05-26T11:53:47+00:00

I have a site that uses images for its navigation. The jQuery fade-in/out code

  • 0

I have a site that uses images for its navigation. The jQuery fade-in/out code works beautifully – as you mouse over the navigation images they fade from greyscale to color. That works great, except that we need the current page nav image to remain in its highlighted/colored state. I can’t seem to get that part to work properly.

        <script type="text/javascript"><!--http://jqueryfordesigners.com/image-cross-fade-transition/-->
    // make nav images highlight on hover
    // when the DOM is ready:
    $(document).ready(function () {
       // find the navigation elements and hook the hover event
       $('#mainmenu li').hover(function() {
          // on hovering over, find the element we want to fade *up*
          var fade = $('> div', this);

          // if the element is currently being animated (to a fadeOut)...
          if (fade.is(':animated')) {
            // ...take it's current opacity back up to 1
            fade.stop().fadeTo(250, 1);
          } else {
            // fade in quickly
            fade.fadeIn(250);
          }
    }, function () {
          // on hovering out, fade the element out
        if (!$(this).hasClass('active')){  
        var fade = $('> div', this);
            if (fade.is(':animated')) {
                fade.stop().fadeTo(3000, 0);
            } else {
            // fade away slowly
            fade.fadeOut(2000);
        }
        }
     });
});
</script>

<script type="text/javascript">
    // when the DOM is ready:
    $(document).ready(function () {
        //Toggle Class on Click
        $("#mainmenu li").click(function() {
            //remove active class from any navigation li
            $('#mainmenu li:active').removeClass(function() {
                    return $(this).prev().attr('class');
                });
                            //change class of the clicked nav li                
            $(this).addClass("active");
        });
    });
    </script>



    <ul id="mainmenu">
        <li id="home">
            <a href="/home">Home<img src="<?php bloginfo(url); ?>/wordpress/wp-content/uploads/2011/09/sara_inactive.png" alt="home" width="152" height="309" /></a>
            <div>
                <a href="/home"><img src="<?php bloginfo(url); ?>/wordpress/wp-content/uploads/2011/09/sara_active.png" alt="home" width="152" height="309" /></a>
            </div>  
        </li>

        <li id="about">
            <a href="/about">About<img src="<?php bloginfo(url); ?>/wordpress/wp-content/uploads/2011/09/david_inactive.png" alt="about" width="152" height="309" /></a>    
            <div>
                <a href="/about"><img src="<?php bloginfo(url); ?>/wordpress/wp-content/uploads/2011/09/david_active.png" alt="home" width="152" height="309" /></a>
            </div>                      
        </li>
        <li id="store">
            <a href="/store">Store<img src="<?php bloginfo(url); ?>/wordpress/wp-content/uploads/2011/09/canyon_inactive.png" alt="" width="152" height="309" /></a>
            <div>
                <a href="/store"><img src="<?php bloginfo(url); ?>/wordpress/wp-content/uploads/2011/09/canyon_active.png" alt="home" width="152" height="309" /></a>
            </div>                          
        </li>
        <li id="information"><a href="/information">Information
            <img src="<?php bloginfo(url); ?>/wordpress/wp-content/uploads/2011/09/wading_inactive.png" alt="" width="152" height="309" /></a>
            <div>
                <a href="/information"><img src="<?php bloginfo(url); ?>/wordpress/wp-content/uploads/2011/09/wading_active.png" alt="home" width="152" height="309" /></a>
            </div>                          
        </li>
        <li id="contact"><a href="/contact">Contact
            <img src="<?php bloginfo(url); ?>/wordpress/wp-content/uploads/2011/09/wall_inactive.png" alt="" width="152" height="309" /></a>
            <div>
                <a href="/contact"><img src="<?php bloginfo(url); ?>/wordpress/wp-content/uploads/2011/09/wall_active.png" alt="home" width="152" height="309" /></a>
            </div>                          
        </li>
    </ul>

    </div><!-- #access -->
  • 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-26T11:53:47+00:00Added an answer on May 26, 2026 at 11:53 am

    Are you sure the “active” class is still there after the page is reloaded?

    You set the class client-side, but you also have to do it server side so it’ll be there after the page reload.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a site that currently uses images on a file server. The images
I currently have a site that uses the JQuery cycle plugin. The site uses
I have a site that uses a large centered background image, which naturally loads
I have a site that uses a couple DropDownLists that are databound. I was
I have a site that uses a menu control tied to a sitemapdatasource which
Ok, so I have a site that uses the google maps API, and I
I have a PHP site that uses a fairly common authentication scheme. The entire
I have a web site that I administer that uses Apache 2.0 on the
We have an ASP.NET application running at a customer site that uses ActiveDirectory for
I have a site I made really fast that uses floats to display different

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.