Git Product home page Git Product logo

fooller / domlastic Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ymc-thzi/domlastic

0.0 1.0 0.0 4.19 MB

DomLastic.js is a jquery plugin that adds jointed bouncing effects to your HTML elements. You can connect dom elements so that they behave like elastic physically jointed bodies. Make your list items bouncing like messages on iOS when scrolling or fire a customizable effect on any dom manipulation.

License: MIT License

JavaScript 100.00%

domlastic's Introduction

DomLastic.js

DomLastic.js is a jquery plugin that adds jointed bouncing effects to your HTML elements.
You can connect dom elements so that they behave like elastic physically jointed bodies. Make your list items bouncing like messages on iOS when scrolling or fire a customizable effect on any dom manipulation.
TEST THE DEMO

Install

  • Installation with npm: packagename "domlastic"
    $ npm install domlastic

  • Installation with bower.io: packagename "domlastic"
    $ bower install domlastic

  • Manual installation: copy and link the file domlastic.js to your project
    domlastic.js

Usage

Example 1: Init and trigger animation

<script>
domLastic.init({
  itemsClassnameToConnect: 'item'
});

domLastic.animateItems();
</script>

<div>
  <div class="item">item 1</div>
  <div class="item">item 2</div>
  <div class="item">item 3</div>
</div>

Example 2: Callback after animation has finished

<script>
domLastic.init ({
  itemsClassnameToConnect: 'item',
  callback: function() {
    console.log( 'anim finished');
  }
});

domLastic.animateItems();
</script>

<div>
  <div class="item">item 1</div>
  <div class="item">item 2</div>
  <div class="item">item 3</div>
</div>

Example 3: Horizontal animation with custom parameters. Connect any DOM element like Images...

<script>
domLastic.init({
  itemsClassnameToConnect: 'item',
  itemsJointStrength: 10, //value optimum between 10 - 100
  animationSpeed: 500, //value optimum 300 - 1000
  animationIntensity: 0.6, //value optimum optimum 0.5 - 1
  animationDirection: 'horizontal'
});

domLastic.animateItems();
</script>
<div>
  <div class="item"><img src="..." /></div>
  <div class="item"><img src="..." /></div>
  <div class="item"><img src="..." /></div>
</div>
Attribute default type
itemsClassnameToConnect string
itemsJointStrength 20 int
animationSpeed 600 int(ms)
animationIntensity 0.5 float
animationDirection 'horizontal' string
callback func()

animationDirection Types:

  • 'horizontal'
  • 'vertical'

Dependencies

  • jQuery

Browser Support

Browser
Version 4.0 9.0 2.0 3.1 9.0

domlastic's People

Contributors

ymc-thzi avatar

Watchers

James Cloos 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.