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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:52:49+00:00 2026-05-18T23:52:49+00:00

I am trying to do fadein/out effect when I change innerHTML of a div.

  • 0

I am trying to do fadein/out effect when I change innerHTML of a div. Even tried example given at safari doc

I want the div to fade-out, change the contents and then fade-in again with new content.

<style>
.cv { background-color: #eee; -webkit-transition: all 1s ease-in-out;}
.cf {opacity: 0;}
</style>
<body> 
 <div id="main"> 
  <div id="c"> OLD </div>
 </div> 
</body>
<script> 
var c = document.getElementById("c");
c.setAttribute("class", "cf");
c.innerHTML = '';
c.appendChild(fragment);
c.setAttribute("class", "cv");
</script>

Please help me here

  • 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-18T23:52:50+00:00Added an answer on May 18, 2026 at 11:52 pm

    This is what I finally ended doing. Thank you all for the answers

    init: function(fragment) {
            var c = document.getElementById("c");
            c.addEventListener( 'webkitTransitionEnd', IDR.callHook(c, fragment), false);
            c.setAttribute("class", "cv hide"); 
         },
    
         callHook: function(c, fragment) {
            var fp = function() {
               c.removeEventListener('webkitTransitionEnd', fp, false);
               c.innerHTML = '';
               c.setAttribute("class", "cv");
               c.appendChild(fragment);
            };
            return fp;
         },
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to do a fade effect, that fades out a div and
I have been trying to make a div fade in evey 30sec and out
I'm trying to add a simple fade in/out effect to the buttons by jQuery
im trying to make a div fade out and then have a second div
I'm trying to build this effect where divs fade in and out continuously. Where
I am trying to produce a blinking effect using dojo fadeIn/Out. The following snippet
I'm trying to create a fadeIn/Out effect on a site I created (edit: site
I’m trying to create a looping fade in/out effect for an image. It’s working
I'm trying to create a slick fade in/fade out effect when users hover over
I'm trying to fade out an div (with an image inside) and fade in

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.