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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:18:14+00:00 2026-05-31T08:18:14+00:00

Revising the bootstrap-modal jquery plugin from Twitter’s bootstrap I see that they use CSS

  • 0

Revising the bootstrap-modal jquery plugin from Twitter’s bootstrap I see that they use CSS transitions for the fading effect.

One thing that intrigues me from code is this line:

that.$element[0].offsetWidth // force reflow

If that line is commented transition doesn’t work.
All reference I’ve found about its meaning is that “force reflow” comment.

How reading that property can affect CSS transitions? Is this to address a bug in browsers?

  • 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-31T08:18:16+00:00Added an answer on May 31, 2026 at 8:18 am

    Bit of a late reply, but I’m tackling some issues with CSS transitions which I think relate to this bit of code you’ve found, and hopefully help you out with understanding it!

    Basically, I’m toggling a class from Javascript / jQuery that adds css transitions to a dom element. The CSS of this element is then updated which causes the transition to occur. A simplified version of the code is below:

    var myelement = $("myselector");
    
    // Set z-indexes before the transition
    myelement.css("z-index", 1); 
    
    var reflow = root.offset().left; // Re-flow the page
    
    // Set the transition class on the element which will animate
    myelement.addClass("trans");
    myelement.css("width", 0 + "px"); // Animate to nothing
    

    So if I uncomment my re-flow line, my transition will occur, but sometimes (it seems more often in safari) the z-index of myelement won’t have been updated.

    To me, it seems that in certain situations, the styles written to the dom are being buffered somewhere and not being flushed.

    That’s where the call to the left offset comes in. This is one of the properties that are said to cause a re-flow in the page. This is obviously usually a bad thing performance wise, but it seems necessary to prevent the css transitions picking up the wrong values.

    There’s an interesting Mozilla bug lodged which discusses the same subject. Might be of some interest. They suggest the addition of an API to properly start transitions from code.

    This is also an interesting SO post about forcing re-flows.

    Hope this helps! 🙂

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

Sidebar

Related Questions

Revising code of jQuery.reveal plugin (http://www.zurb.com/playground/reveal-modal-plugin) and trying to understand how it handles the
On the slides I am revising from it says the following: Live objects can
I am in the process of revising code to use TVP to send data
I am working on revising our office intranet site from .ASP under IIS5 to
I'm revising code I did not write that uses JavaMail, and having a little
I'm revising my question from a few days ago. Rewrote my query. Can someone
Revising for php and cant seem to get this to print the values out
Im revising my auto-complete style search script. The site has 2 categories... movies and
I need some help revising this. It keeps only displaying 0s as the temp.
So I am revising for an exam and have struck a big rock 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.