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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:44:42+00:00 2026-05-23T02:44:42+00:00

i tried to create a simple css background-image transition usind the jquery fadeIn fadeOut

  • 0

i tried to create a simple css background-image transition usind the jquery fadeIn fadeOut function. I used the description on the jquery page to create mine.
Now, it works quite fine but I would like to have kind of a cross-fade transition. At the moment it’s just fading to white and from white. Here the code:

<script language="JavaScript" type="text/javascript">
   $(document).ready(function(){

   var imgArr = new Array( 
   'img/bg_1.jpg',
   'img/bg_2.jpg'
   );

   var preloadArr = new Array();
   var i;

   for(i=0; i < imgArr.length; i++){
   preloadArr[i] = new Image();
   preloadArr[i].src = imgArr[i];
   }

   var currImg = 1;
   var intID = setInterval(changeImg, 10000);

   function changeImg(){
      $('#head_bg').fadeOut('slow', function(){
      $(this).css('background','url(' + preloadArr[currImg++%preloadArr.length].src +') top center no-repeat');
      }).fadeIn('slow');
    }

  });
</script>

Hopefully someone knows a solution 🙂

Now I treid it with switching two different background classes, providing the same result.

NEW!!!NEW!!!NEW!!!NEW!!!NEW!!!

<script language="JavaScript" type="text/javascript">
$(document).ready(function(){
   $('#head_bg').delay(4000).animate({opacity: 0}, 2000, function(){
      $('#head_bg').removeClass().addClass('bg2').animate({opacity: 1}, 2000);
   })
});
</script>

Now I have two ways of doing the same ;).. But still don’t have a clue how to do it with two seperate div’s and making them vsible over each other and revolving it. Sorry but I don’t get to the point of how to.. could someone give me a quick example, please?

  • 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-23T02:44:43+00:00Added an answer on May 23, 2026 at 2:44 am

    Now I constructed a solution, thanks for the hint with fading two divs:

    .bild {
      position:absolute;
      display:none;
      width:1000px;
      height:735px;
    }
    
    <div id="head_bg">
    <div class="bild"><img src="img/bg_1.jpg" /></div>
    <div class="bild"><img src="img/bg_2.jpg" /></div>
    </div>
    
    <script type='text/javascript'>
       $('.bild').hide();
    
       function bgSlide() {
         $(".bild").first().appendTo('#head_bg').fadeOut(5000);
         $(".bild").first().fadeIn(5000);
    
       setTimeout(bgSlide, 7000);
    }
    bgSlide();
    </script>
    

    But with one litte limitation. I wanted to have images overflowing the screen without crating scollbars. That’s why I used the css background-image tag. But for now it’s absolutely fine for me to move on with smaller images.

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

Sidebar

Related Questions

I've tried to build a simple comments-view using css and jquery, where at the
I just created a simple page where I tried to emulate ajax with CSS.
I'm trying to use CSS to create a 'greyed out' effect on my page
I'm trying to create a simple modal popup. I have the CSS done, and
I'm following the tutorial here: http://docs.jquery.com/Plugins/Authoring I just wanted to create a simple plugin
We have tried to create sample webservices helloworld in Java using Jersey and Tomcat
I created a simple test with SendKeys, and tried both SendWait and Send. Private
I have created a small and simple android app. I tried installing it on
I created a sample webservice which contain default 'HelloWorld' function as 'webmethod' when tried
I tried to create this by following the video at http://www.asp.net/learn/videos/video-7026.aspx where Joe Stagner

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.