$ npm install vibeAPI (0.9)
- element denotes a native DOM Element
- token denotes a single class name
- $ denotes a jQuery-compatible lib such as ender
- ? denotes a optional parameter
- stack denotes an array or collection of elements
- ssv denotes where multiple classes can be passed via array, space-separated string, or a callback to determine them. Callbacks run for each element as
thisand may returnfalseto cease further iterations.
vibe.addClass(element, token)vibe.removeClass(element, token)vibe.toggleClass(element, token, force?)vibe.hasClass(element, token)
jQueryish chain methods
$(elements).addClass(ssv)$(elements).removeClass(ssv)$(elements).toggleClass(ssv, force?)$(elements).hasClass(token)→trueif any element has it
In standalone usage, these methods can be run via .call
vibe.fn.addClass.call(stack, ssv)vibe.fn.removeClass.call(stack, ssv)vibe.fn.toggleClass.call(stack, ssv, force?)vibe.fn.hasClass.call(stack, token)
ender build vibeender('html').addClass('example').removeClass('another')- Works in all browsers. Tested in Chrome, FF, Opera, IE7/8
- Uses the native
.classListwhere available and otherwise uses.className
Support this project by tipping the developer =)