1.1.2 • Published 8 years ago

clus v1.1.2

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

Clus - A minimalist JavaScript library for modern browsers.

dependencies devDependencies

Emoji Commit

Commit TypeEmoji
Initial Commit:tada: :tada:
Structure:art: :art:
Documentation:memo: :memo:
New Idea:bulb: :bulb:
New Feature:sparkles: :sparkles:
Bug:bug: :bug:
Version Tag:bookmark: :bookmark:
Performance:racehorse: :racehorse:
Tooling:wrench: :wrench:
Tests:rotating_light: :rotating_light:
Deprecation:poop: :poop:
Work In Progress (WIP):construction: :construction:
Upgrading:arrow_up: :arrow_up:

Example:

":art: fixing coding standard"

Usage

Install

$ npm i clus --save
# or
$ bower i clus

Instance methods

  • .ready()
  • .addClass()
  • .removeClass()
  • .hasClass()
  • .toggleClass()
  • .append()
  • .appendTo()
  • .parent()
  • .parents()
  • $.each()
  • .each()
  • $.map()
  • .map()
  • .on()
  • .off()

DOM

$(document).ready()

$(document).ready(function () {
    // DOM is ready
});

// or

$(function () {
    // DOM is ready
});

.addClass(clasNname)

Example:

$('.hello').addClass('world');
$('p').addClass('hello world');
// or
$('p').addClass('hello').addClass('world');

.removeClass(clasNname)

Example:

$('.hello').removeClass('hello').addClass('hi');
$('p').addClass('hello world').removeClass('hello world');
// or
$('p').addClass('hello world').removeClass('hello').removeClass('world');

.hasClass(clasNname)

Example:

$('p').hasClass('hello'); // true
$('p').hasClass('world'); // false

.toggleClass(clasNname)

Example:

$('p').toggleClass('hello');

.append(DOMString)

Example:

$('body').append('<h1>Hello Clus</h1>');

.appendTo(selector)

Example:

$('<h1>Hello Clus</h1>').appendTo('body');

.parent()

Example:

$('.hello').parent();

.parents()

Example:

$('.hello').parents();
$('.hello').parents('body');

$.each()

Example:

$.each(['just', 'hello', 'world'], function (item, index) {
    console.log(item, index);
});
// just 0
// hello 1
// world 2

.each()

Example:

$('.hello').each(function (item, index) {
    $(this).addClass('world');
    console.log($(this));
});

$.map()

Example:

$.map(['just', 'hello', 'world'], function (item, index) {
    console.log(item, index);
});
// just 0
// hello 1
// world 2

.map()

Example:

$('.hello').map(function (item, index) {
    $(this).addClass('world');
    console.log($(this));
});

.on()

Example:

$('.hello').on('click', function () {
    console.log($(this));
});

$(document).on('click', '.hello', function () {
    console.log($(this));
});

.off()

Example:

let hello = function () {
    console.log('hello');
}
$(document).on('click', '.hello', hello);
$(document).off('click', '.hello', hello);
1.1.2

8 years ago

1.1.1

8 years ago

1.2.0

8 years ago

1.1.0

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

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