height-checker
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Height Checker

The simple tool that checks height of DOM elements and write console messages if it is not multiplie of specific number.

Usage

  1. Install the package:
> npm install height-checker
  1. Add data-check-height attribute to DOM elements that should be checked:
<div data-check-height="8">
</div>

data-check-height attribute should contain multiplier. If its value is empty, the default value 8 will be used.

  1. Init height checker:
import { initHeightChecker } from 'height-checker';
 
initHeightChecker();

Also, you can pass log level parameter to the method:

initHeightChecker('info');

Allowed values of log level:

  • log
  • warn
  • info
  • error

The height will be checked on window resize as well as on DOM manipulation. Once element's height is not multiplie of the defined size, you will see error message in browser's console.

License

The project is released under the MIT License.

Package Sidebar

Install

npm i height-checker

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

7.28 kB

Total Files

6

Last publish

Collaborators

  • sergeyzwezdin