1.1.0 • Published 8 years ago

classes-manager v1.1.0

Weekly downloads
3
License
ISC
Repository
github
Last release
8 years ago

classes-manager

Add, remove, list or check style classes of an element, or group of them, in your DOM. Implemented with ES2015 and only native js. For a faster performance I recommend passing the element, or elements, via native .querySelector(), or .querySelectorAll(), it is way faster than other libraries like jQuery.

Install

$ npm install classes-manager

Usage

import classes from 'classes-manager'

API

.add(el, class)

Add a class to the element/s.

.remove(el, class)

Remove a class from the element/s.

.has(el, class)

Check if a class is present in the element/s. It returns values of T/F.

.classes(el)

Return an array of classes present in the element.

classes(el)
// => ['active', 'nav']

Example

import classes from 'classes-manager'

classes.add(document.querySelector('.existingClass'),'classToAdd')
1.1.0

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago