Giter Club home page Giter Club logo

vanillaconejs's Introduction

VanillaConeJS

A simple collections of utilities to make common JS authoring tasks easier.

To instantiate simple call:

new VanillaCone();

Here are the available utility methods that comes with VinillaCone:

xhr | xhr([options])

Performs what is known as AJAX calls to a desired url in either GET or POST methods.

Options:

  • url = url to request data from
  • data = data to pass to url
  • type = method type ('GET' or 'POST')
  • success = callback for successful request
  • error = callback for unsuccessful request

addClass | addClass(DOMElement, string)

Adds a class to a given element.

addClass(document.querySelector('#some-elm'), 'new-class-name');

removeClass | removeClass(DOMElement, string)

Removes a class from a given element.

removeClass(document.querySelector('#some-elm'), 'class-name-to-remove');

hasClass | hasClass(DOMElement, string)

Returns true or false depending on if given element has said class.

if(hasClass(document.querySelector('#some-elm'), 'class-to-search')){
	...
}

wrap | wrap(DOMElement, DOMElement)

Wraps given element (first param), within another element (second peram).

wrap(document.querySelector('#element-to-be-wrapped'), document.querySelector('#element-to-wrap-in'));

parents | parent(DOMElement, string)

From a given element (first param), this method traverses up to the first found parent (second param). Parent selector string supports all querySelector combinations (class, id, attribute, tag etc).

parents(document.querySelector('#any-element'), '#parent-element-to-search-for');

remove | remove(DOMelement)

Removes given element from page.

remove(document.querySelector('#any-element'));

insertAfter | insertAfter(DOMElement, DOMElement)

Inserts a given element (first param) after any element on the page (second param).

insertAfter(document.querySelector('#element-to-be-moved'), document.querySelector('#element-we-insert-after'));

serialize | serialize()

Quick method to serialize a form into name=value& string for the above xhr method or other logic.

serialize();

vanillaconejs's People

Contributors

drolsen avatar

Watchers

 avatar  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.