Skip to content
/ bounce Public

Simple demonstration of how you can setup a JavaScript library

License

Notifications You must be signed in to change notification settings

drkx/bounce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bounce

Simple demonstration of how you can setup a JavaScript library

Synopsis

A small library that can make a an element of your choosing bounce

Code Example

The easiest way to use bounce is putting it in a variable and calling the init function on it. It will than target the element with class bounce on it

//Initialize the first object without params so the default values are used
var bounce = Bounce();
bounce.init();

If you want however you can use a custom selector and change the gravity and the update speed using a settings object

//Initialize the second object with a different selector and a gravity of only to so it goes...much...slower
var bounce2 = Bounce();
bounce2.init('.bounce2', {gravity: 2, updateSpeed:2});

Demo

See bounce demo

Motivation

This library was created as a small example on how you can create a library.

Installation

Just download bounce.js, put it in the head of your page and call it. Make sure the parent of the targeted element has a hight otherwise there's not much room to bounce

API Reference

init

Parameters Type Optional Description
selector string true Css selector that targets the element that needs to bounce
settings object true Object containing settings gravity and/or updateSpeed

About

Simple demonstration of how you can setup a JavaScript library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published