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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:08:59+00:00 2026-05-26T12:08:59+00:00

I am wondering if it is possible to animate background url using jQuery, and

  • 0

I am wondering if it is possible to animate background url using jQuery, and if not, what alternatives I have. My nav bar HTML looks like this:

<li><a href="index.html" class="fade nav top current" id="index"><img style="margin: 90px 0 0 0px" src="images/home.png"></a></li>
     <li><a href="about.html" class="fade nav bottom" id="about"><img class="flip" style="margin: 84px 3px 0 0px" src="images/about.png"></a></li>
     <li><a href="#" id="contact" class="nav top"><img style="margin: 82px 2px 0 0px" src="images/contact.png"></a></li>

Then the CSS for the links in the nav bar looks like this:

a.nav {
    height: 170px;
    width: 118px;
    display: block;
    margin: 0 auto;
}

a.top, a.bottom {
    background: url('images/bodhi-leaf-brown.png') no-repeat;
}

a.current, nav a:hover {
    background: url('images/bodhi-leaf-green.png') no-repeat !important;
}

Then I have a jQuery script which both controls the sliding of a contact form and adds and removes the class “current” to/from the nav links so that the background image changes:

$(function ()
{

    var newHash = "",
        $mainContent = $("#main-content"),
        $pageWrap = $("#page-wrap"),
        baseHeight = 0,
        $el,
    curTab = "#index";

    $("nav").delegate("a.fade", "click", function ()
    {
        window.location.hash = $(this).attr("href");
        $("#panel").slideUp("slow");
        $(this).addClass("current", 3000);
        $("#contact").removeClass("current", 3000);
        return false;
    });

    $(window).bind('hashchange', function ()
    {

        newHash = window.location.hash.substring(1);

        if (newHash)
        {
            $pageWrap.height($pageWrap.height());
            baseHeight = $pageWrap.height() - $mainContent.height();

            $mainContent
                .find("#guts")
                .fadeOut(500, function ()
                {
                    $mainContent.hide().load(newHash + " #guts", function ()
                    {
                        $pageWrap.animate({ height: baseHeight + $mainContent.height() + "px" }, function ()
                        {
                            $mainContent.fadeIn(500);
                            $pageWrap.css("height", "auto"); 
                        });

                        $("nav a").removeClass("current");
                    curTab = "#" + /^(.+)\..+$/.exec(newHash)[1];
                    $(curTab).addClass("current");
                    });
                });
        };
    });

$("#contact").click(function ()
{
    $("#panel").slideDown("slow");
    $(this).addClass("current");
    $("#index, #about").removeClass("current");
    return false;
});

$(".close").click(function ()
{
    $("#panel").slideUp("slow");
    $(curTab).addClass("current");
    $("#contact").removeClass("current");
    return false;
});

    $(window).trigger('hashchange');

});

I am wanting to have a fade between the background images on hover and for the click functions too. Hence my question about animating the background images using jQuery. If it is not possible to do this, is there another method that I could use which would incorporate the existing script that I have?

You can see the page as it currently stands here.

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-26T12:08:59+00:00Added an answer on May 26, 2026 at 12:08 pm

    here is how you can use the hover function with animate. There are more effect just find the right for you on the jQuery document page for animation.

     $("nav a").hover(
        function() {
            $(this).animate({
                opacity: .6
            }, {
                duration: 100,
                specialEasing: {
                    opacity: 'linear',
                },
                complete: function() {
    
                    $(this).addClass("aHover").animate({
                        opacity: 1
                    }, {
                        duration: 100,
                        specialEasing: {
                            opacity: 'linear',
                        }
                    });
                }
            });
        }, function() {
            $(this).animate({
                opacity: .6
            }, {
                duration: 100,
                specialEasing: {
                    opacity: 'linear',
                },
                complete: function() {
    
                    $(this).removeClass("aHover").animate({
                        opacity: 1
                    }, {
                        duration: 100,
                        specialEasing: {
                            opacity: 'linear',
                        }
                    });
                }
            });
        });
    

    hover animate

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

Sidebar

Related Questions

I have not worked so much with files: I am wondering about possible issues
I am wondering how its possible to permanently show the vertical bar of a
I was wondering whether there's a way of using multiple selectors in jQuery and
I wondering if it possible to have a preprocessor OR or AND statement? I
I was just wondering if it's possible to animate the height of a grid
I'm wondering if it is at all possible to create a Jquery animation with
just wondering if its possible to have a hidden parent and a visible child
I was wondering if its possible to get Android application info like (name, version,
Possible Duplicate: How to loop a css background image with Jquery every few seconds?
I am wondering it is possible to have multiple GridFS in Mongo? The reason

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.