Parcourir la source

ScrollBar: cache bar width calculation

Leopoldthecoder il y a 8 ans
Parent
commit
869600f4d5
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      src/utils/scrollbar-width.js

+ 2 - 1
src/utils/scrollbar-width.js

@@ -23,6 +23,7 @@ export default function() {
 
   const widthWithScroll = inner.offsetWidth;
   outer.parentNode.removeChild(outer);
+  scrollBarWidth = widthNoScroll - widthWithScroll;
 
-  return widthNoScroll - widthWithScroll;
+  return scrollBarWidth;
 };