/domify.js

A Simple lightweight Javascript library for DOM Manipulation and faster web application development

Primary LanguageJavaScriptMIT LicenseMIT

The JavaScript library for faster and easier development of web applications.
A simple lightweight Javascript library for DOM Manipulation and faster web application development.

This repository is released under the MIT license. PRs welcome!



Library Documentation

You probably need a Javascript library to interact with DOM, Event handlers, and a lightweight, modern and performant javascript library. This does:

  • DOM Manipulation (selector, id, class, each, etc.)
  • DOM editing (classes & attributes, html, etc.)
  • Event handling
  • Animation (Fadein, Fadeout, scroll up, etc)
  • Interacting with browser webcam
  • Clipboard features

A couple of simple examples:

// Simple events handler
 dom('button').on('click', function() {
  alert('Hello, world');
})

// hide element
dom('button').on('click', function() {
  dom('h1').hide()
})

Getting Started

There are few ways to use domify.js

Link locally

You can download/clone the library directly to your local system and immediately link using the script tag

<script src="src/domify.js"></script>

// minified version
<script src="src/domify.min.js"></script>

Use a CDN

jsdelivr.com is an awesome CDN (Content Delivery Network) service that hosts many open source projects so you don't need to download the code, just link:

<script src="https://cdn.jsdelivr.net/gh/MoralistFestus/domify.js@2.0/src/domify.js"></script>

// minified version
<script src="https://cdn.jsdelivr.net/gh/MoralistFestus/domify.js@2.0/src/domify.min.js"></script>

Functions

  • hide(): Hides the element of the specified selector (tag, class, id, attr)
  • show(): Shows the element of the specified selector (tag, class, id, attr)
  • addClass(): Adds or creates a new class attribute if specified
  • removeClass(): Removes specified class
  • toggleClass(): Toggle classes upon another
  • output(): Writes to an HTML element
  • camera(): Request browser's permission for web camera eligibility (if supported)
  • copy(): Copy to clipboard function
  • color(): Add text color to an HTML element
  • bgcolor(): Adds background color to an HTML element
  • prevent(): Prevent form action

Inspiration

Inspirations from code4mom.js and jquery.

Contributing

It's open source and contributions welcomed.

Author and License

This library is currently maintained by moralistfestus and Co-contributors, licensed under MIT License