Skip to content

Commit

Permalink
use inner.getBoundingClientRect.width instead offsetWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
AllenFang committed Jan 22, 2017
1 parent b4108ea commit 98a586c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ export default {
outer.appendChild(inner);

document.body.appendChild(outer);
const w1 = inner.offsetWidth;
const w1 = inner.getBoundingClientRect().width;
outer.style.overflow = 'scroll';
let w2 = inner.offsetWidth;
let w2 = inner.getBoundingClientRect().width;

if (w1 === w2) w2 = outer.clientWidth;

document.body.removeChild(outer);
Expand Down

0 comments on commit 98a586c

Please sign in to comment.