1.1.3 • Published 7 years ago

get-size-percent v1.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

getSizePercent

Get an element's width or height in percentage

Usage

<style>
.my-element {
  width: 85%
}
</style>
<body>
  <div class="my-element"></div>
</body>
const width = getSizePercent({ selector: '.my-element', property: 'width' });
// width === '85%'

Thanks

Borrowed a nice trick from this answer, implementation is more stable (on some widths the calculations weren't completely accurate).

So big thanks to timofey

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago