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

  • SEARCH
  • Home
  • 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 6333181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:24:41+00:00 2026-05-24T18:24:41+00:00

I am using the jQuery bgFade Plugin and it fades the background image nicely

  • 0

I am using the jQuery bgFade Plugin and it fades the background image nicely but there’s a problem with it. It deletes everything that is in the div when you hover. You can see it here: http://weebuild1.yolasite.com/ (hover over the first box that says “Packages”)

This is the code:

<script type="text/javascript">
$(document).ready(function() {
$('.packages').hover(function() {
$(this).bgFade('fadeIn');
}, function() {
$(this).bgFade('fadeOut');
});
});
</script> 

Can someone help me fix this issue? As you all know, this cannot stay like this. It needs to only fade the background and not remove the contents.

The plugin’s jQuery is here: http://weebuild1.yolasite.com/resources/javascript/jquery.bgFade.js

I hope someone can help. Thanks in advance!

  • 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-24T18:24:44+00:00Added an answer on May 24, 2026 at 6:24 pm

    I might even just forget about the fade plugin and do something like this.

    Solution 1 ( uses <img> )

    http://jsfiddle.net/yJHRA/3/ ( Should work ie6+. Not tested. )

    HTML:

    <div class="box">
        <img class="boxBG1" src="http://lorempixum.com/400/200/" alt="" />
        <img class="boxBG2" src="http://lorempixum.com/g/400/200/" alt="" />
    
        <div class="boxContent">
            <h1>Lipsum</h1>
            <p>
                Lorem ipsum dolor sit amet.
            </p>
        </div>
    </div>
    

    CSS:

    .box {
        float: left;
        position: relative;
        width: 400px;
        height: 200px;
    }
    
    .boxBG1, .boxBG2 {
        position: absolute;
        top: 0px;
        left: 0px;
        width: 400px;
        height: 200px;
    }
    .boxBG1 { z-index: 5; }
    .boxBG2 { z-index: 10; display: none; }
    
    .boxContent {
        float: left;
        position:relative;
        z-index: 15;
    
        color: #fff;
    }
    

    jQuery:

    $(document).ready(function() {
    
        $(".box").each(function(){
            $(this).mouseenter(function() {
                $(this).find('.boxBG2').stop(false,true).fadeIn(400);
            });
            $(this).mouseleave(function() {
                $(this).find('.boxBG2').stop(false,true).fadeOut(400);
            });
        });
    
    });
    

    Solution 2 ( uses background images)

    http://jsfiddle.net/yJHRA/4/

    HTML:

    <div class="box">
        <div class="boxContent">
            <h1>Lipsum</h1>
            <p>
                Lorem ipsum dolor sit amet.
            </p>
        </div>
        <!-- the extra .box2 div is generated here. Not necessary but i thought.. why the heck not.. ( not necessary as in you could just add that div here manually as well.. ) -->
    </div>
    

    CSS:

    .box, .box2 {
        float: left;
        width: 400px;
        height: 200px;
    }
    .box {
        position: relative;
        background: url("http://img695.imageshack.us/img695/4026/firstr.jpg") no-repeat top left;
    }
    .box2 {
        position: absolute;
        z-index: 5;
        background: url("http://img840.imageshack.us/img840/5213/secondm.jpg") no-repeat top left;
        display: none;
    }
    
    .boxContent {
        float: left;
        position:relative;
        z-index: 10;
    }
    

    jQuery:

    $(document).ready(function() {
    
        $(".box").each(function(){
            $(this).append('<div class="box2" />');
    
            $(this).mouseenter(function() {
                $(this).find('.box2').stop(false,true).fadeIn(400);
            });
            $(this).mouseleave(function() {
                $(this).find('.box2').stop(false,true).fadeOut(400);
            });
        });
    
    });
    

    Edit: Added .stop()s so that if someone goes nuts with the hovering, the animation wont go nuts..

    Edit2: forgot that you have multiple boxes.. Fixed..

    Edit3: Added solution 2 which uses background images.

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

Sidebar

Related Questions

Using jquery.load() to replace the content of a div everything works great, however there
Using jQuery, is there a way to select all tag that reference a specific
Using jquery I have a clicking tab mechanism that are nothing but anchor tags
Using jQuery, I need to select all elements that do not have a background
Using jQuery validation plugin but it has no CSV validation. I have made an
Using jquery, I am trying to get a background image to fade into a
Using jquery to validate that there is text in a text box. When I
Using jQuery version 1.4.2 and Validation plugin version 1.8.1 I have a textbox that
Using jquery, how can I find the first div that contains an input with
Using jQuery, how do you check if there is an option selected in a

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.