GithubHelp home page GithubHelp logo

vibe's Introduction

vibe

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

$ npm install vibe

API (0.9)

Parameters

  • 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 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 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

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 =)

License

MIT

vibe's People

Contributors

ryanve avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.