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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:21:51+00:00 2026-06-14T13:21:51+00:00

I have two main elements – some text with a select box on one

  • 0

I have two main elements – some text with a select box on one line, and a div with a gif spinner image on another line. Initially, I am setting the spinner to display:none.

Even though this is part of a larger enterprise application (so event handling etc isn’t really a question here). But what I want to do it whenever some event occurs (i.e. a button click):

  1. the hidden spinner element moves over to guarantee full coverage of the line with the text + the select box, without making the line bigger overall – it should ideally just fit into the exact space that the text + select box cover
  2. Smoothly fade in the spinner and fade out the background element to 100% white

http://jsfiddle.net/Dh4vb/15/
Code:

<div id="wrapper">
    on the <select id="select"></select> of the Month
<div id="spinner"></div>
</div>​

#wrapper {
    margin: 50px;
}

#spinner {
    width: 150px;
    height: 25px;
    background-image: url('http://fedoraproject.org/w/uploads/2/29/Artwork_DesignService_fedora-spinner.gif');
    background-repeat:no-repeat;
    background-size:contain;
    background-position:center; 

    -webkit-transition: opacity .5s ease-in-out;
    -moz-transition: opacity .5s ease-in-out;
    -o-transition: opacity .5s ease-in-out;
    transition: opacity .5s ease-in-out;
    display:none;
}

​

  • 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-06-14T13:21:53+00:00Added an answer on June 14, 2026 at 1:21 pm

    You can see it work here: http://jsfiddle.net/jfriend00/8MJH4/. I made the transition time longer in the demo so you can more clearly see the transition working. Here’s a slightly more advanced version that works as a toggle: http://jsfiddle.net/jfriend00/kwr4m/.

    The idea is that you position the spinner with absolute position (so it’s over the top of the text), but initially opacity: 0 so not visible. Then, you change the opacity of the text to 0 and the opacity of the spinner to 1 and both are set for an opacity CSS transition. Here’s the code:

    JS:

    function run() {
        var spinner = document.getElementById("spinner");
        var fadeText = document.getElementById("fadeText"); 
    
        // make spinner visible
        spinner.style.opacity = 1;
    
        // make text not visible
        fadeText.style.opacity = 0;
    }​
    

    HTML:

    <button id="go" onclick="run()">Go</button>
    <div id="wrapper">
        <div id="fadeText" class="fadeTransition">
        on the <select id="select"></select> of the Month
        </div>
        <div id="spinner" class="fadeTransition"></div>
    </div>​
    

    CSS:

    #wrapper {
        margin: 50px;
        position: relative;
    }
    
    #spinner {
        position: absolute;
        top: 0;
        bottom: 0;
        opacity: 0;
        width: 150px;
        height: 25px;
        background-image: url('http://fedoraproject.org/w/uploads/2/29/Artwork_DesignService_fedora-spinner.gif');
        background-repeat:no-repeat;
        background-size:contain;
        background-position:center; 
    }
    
    .fadeTransition {
        -webkit-transition: opacity 2s ease-in-out;
        -moz-transition: opacity 2s ease-in-out;
        -o-transition: opacity 2s ease-in-out;
        transition: opacity 2s ease-in-out;
    }
    ​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a HTML page that contains two main elements. One is a silverlight
I have two elements on a page. One being the main content container and
I have two MAIN DIVs inside a DIV which is a PART of the
Say you have two main-line branches that have been developed separately for a long
Here I am trying to implement the jQuery I have two main files one
I have a two JavaScript files: Main.js Pmt.js I'm also using thick box (Ajax
I have two lists and one of them has 5 elements and the other
I have a layout with two main divs. The width of each div is
So I have an xml layout im using and it has two main elements,
I have two custom QML elements for audio, one for playing music (and extends

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.