@advertol/control-element-classes
v1.0.0
Published
Add HTML classes to zone elements based on zone state.
Downloads
3,270
Maintainers
Readme
@advertol/control-element-classes
Add HTML classes to zone DOM elements based on zone state.
Install
npm install @advertol/control-element-classes --save
Usage
import advertol from '@advertol/core';
import ElementClassesControl from '@advertol/control-element-classes';
const instance = advertol({
// …
control: [
new ElementClassesControl({
isHidden: 'is-hidden',
isLoaded: 'is-loaded',
isEmpty: 'is-empty'
})
]
});
instance.resolve();
API
elementClassesControl(classes)
classes
Type: Object
HTML classes to apply on zone DOM element based on current state.
| Property | Type | Description |
| --- | --- | --- |
| isHidden
| string
| HTML class when zone is hidden. |
| isLoaded
| string
| HTML class when zone is loaded. |
| isEmpty
| string
| HTML class when zone is empty. |
Browser support
Tested in IE9+ and all modern browsers, assuming Element.prototype.classList
is available.
Test
For automated tests, run npm run test:automated
(append :watch
for watcher support).
License
MIT © Ivan Nikolić