]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
fix: trigger reflow / layout thrashing - closes #11943 11944/head
authorDaniel Ruf <d.ruf@bitexpert.de>
Tue, 17 Dec 2019 13:21:50 +0000 (14:21 +0100)
committerDaniel Ruf <d.ruf@bitexpert.de>
Tue, 17 Dec 2019 13:21:50 +0000 (14:21 +0100)
js/foundation.util.motion.js

index 07e760cb5bb02014428f848f2d5d2c0e25d40a13..4bd3e1a47d8967da5712cfd909667533132e095b 100644 (file)
@@ -77,6 +77,10 @@ function animate(isIn, element, animation, cb) {
 
   // Start the animation
   requestAnimationFrame(() => {
+    // will trigger the browser to synchronously calculate the style and layout
+    // also called reflow or layout thrashing
+    // see https://gist.github.com/paulirish/5d52fb081b3570c81e3a
+    element[0].offsetWidth;
     element
       .css('transition', '')
       .addClass(activeClass);