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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:07:20+00:00 2026-06-08T13:07:20+00:00

I am currently trying to animate two div elements in a carousel-type container. Here

  • 0

I am currently trying to animate two div elements in a carousel-type container. Here is the markup as it appears in the DOM:

<div id="transitioner" style="width: 2880px; height: 775px; left: -1440px; ">
    <div id="view1" class="view active" style="width: 1440px; height: 775px; ">
        <header>
            <h1>This is page 1</h1>
        </header>
        <article style="height: 699px; ">
            <p>Tap me anywhere to go to the next view</p>
        </article>
        <footer>
            <p>This is my footer</p>
        </footer>    
    </div>
    <div id="view2" class="view" style="width: 1440px; height: 775px; ">
        <header style="">
            <h1>This is page 2</h1>
        </header>
    </div>
</div>

And here is the CSS for the #transitioner element:

#transitioner {
    position: absolute;
    top: 0;
    -webkit-transition: all 0.2s ease-in-out;
}

Finally, the JS:

function GotoView(view)
{
    var roller = $('<div id="transitioner" />');
    roller.width((viewport.width * 2)).height(viewport.height);
    var current = $('.view.active').clone(true, true);
    $('.view.active').remove();
    current.prependTo(roller);

    var new_view = view.clone(true, true);
    view.remove();
    new_view.appendTo(roller);

    roller.appendTo($('body'));
    $('body').addClass('transitioning');
    //window.setTimeout(function() { roller.css({ left: 0 - viewport.width }) }, 2000);
    roller.css({ left: 0 - viewport.width });
}

I update the left position of the containing div (i.e. #transitioner), but unless I put in a setTimeout, the CSS transition does not execute, rather the containing div simply ‘jumps’ to the desired new left offset.

I have put together a jsFiddle so you can see the symptoms > http://jsfiddle.net/XPUPQ/

My question is: what is this happening, and short of using the JS setTimeout() is there any way to circumvent this?

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

    You need to trigger a browser reflow

    http://jsfiddle.net/XPUPQ/1/

    You could do that with $("body")[0].offsetWidth; for example.

    This is actually a legit technique that twitter bootstrap uses for example

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

Sidebar

Related Questions

I am trying to animate the dealing of cards. Currently I have two cards,
I'm trying to animate the height of a dataview, but it's currently just sliding
I have two UIImageViews on my object, and I'm trying to animate them to
Currenly I'm trying to animate the component module for a website for a school
Currently trying at add ajax to a site, after much reading I discovered that
Im currently trying to downlaod a audio track from a WCF, i need some
Im currently trying to learn some stuff about encryption, it's algorithms and how it
I am currently trying to write some code that will accept some FTP details,
I'm currently trying out Aptana Studio 3 for PHP development (I'm pretty new to
I am currently trying to categorise a users music collection and the ability to

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.