Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
larukedi edited this page Oct 17, 2014 · 16 revisions

Adding/removing/checking a class

var target = $l('#element');

$l.css.addClass(target, 'hide');
console.log($l.css.hasClass(target, 'hide')); // returns true

$l.css.removeClass(target, 'hide');
console.log($l.css.hasClass(target, 'hide')); // returns false

Toggle a class

Usage: $l.css.toggle(element, className)

var target = $l('#element');
$l.css.toggle(target, 'hide');

Setting/getting CSS attributes

var target = $l('#element');

$l.css.setProperty(target, 'text-align', 'center');
console.log($l.css.getProperty(target, 'text-align')); // prints center

Setting a CSS transition

Usage: $l.css.transition(element, properties)

var target = $l('#element');

// first sample
$l.css.transition(target, { 'color': 'red' });

// second sample
$l.css.transition(
    $l('body'),
    { 'background-color': [ 'silver', '5s ease' ], 'font-size': '25px' }
);
Clone this wiki locally