SkillAgentSearch skills...

Vibe

CSS classes for the masses

Install / Use

/learn @ryanve/Vibe
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

vibe

cross-browser [class] JavaScript module—uses classList where available

$ npm install vibe

API (0.9)

Parameters

  • <b><var>element</var></b> denotes a native DOM Element
  • <b><var>token</var></b> denotes a single class name
  • <b><var>$</var></b> denotes a jQuery-compatible lib such as ender
  • <b><var>?</var></b> denotes a optional parameter
  • <b><var>stack</var></b> denotes an array or collection of elements
  • <b><var>ssv</var></b> denotes where multiple classes can be passed via array, space-separated string, or a callback to determine them. Callbacks run for each element as this and may return false to cease further iterations.

Fast simple static methods

  • vibe.addClass(element, token)
  • vibe.removeClass(element, token)
  • vibe.toggleClass(element, token, force?)
  • vibe.hasClass(element, token)

jQueryish chain methods

Integrated syntax

  • $(elements).addClass(ssv)
  • $(elements).removeClass(ssv)
  • $(elements).toggleClass(ssv, force?)
  • $(elements).hasClass(token)true if any element has it

Standalone syntax

In <b>standalone</b> 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

Include vibe in your ender build

ender build vibe

ender usage example

ender('html').addClass('example').removeClass('another')

Compatibility

  • Works in all browsers. Tested in Chrome, FF, Opera, IE7/8
  • Uses the native .classList where available and otherwise uses .className

Fund

Support this project by tipping the developer <samp><b>=)</b></samp>

License

MIT

View on GitHub
GitHub Stars7
CategoryDevelopment
Updated9mo ago
Forks0

Languages

JavaScript

Security Score

67/100

Audited on Jun 26, 2025

No findings