Skip to content

Release is a JavaScript plugin that enables the execution of an action after the user keeps the mouse pressed for a custom amount of time.

Notifications You must be signed in to change notification settings

daviferreira/release

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Release

Release is a JavaScript plugin that enables the execution of an action after the user keeps the mouse pressed for a custom amount of time.

Build Status

Demos

Basic usage

First you need to attach release stylesheet and javascript files:

<link rel="stylesheet" href="css/release.css">
<script src="js/release.js"></script>

Now you can instantiate a Release object by using the following code:

<script>var release = new Release('.release', {onRelease: myFunction()});</script>

With the above code, all elements with the release class will receive a mouseup event that will execute myFunction()_ after 3 seconds (default value).

Initialization options

defaults: {
    animationTime: 200,
    increaseRate: 15,
    onRelease: '',
    releaseTime: 3000
}
  • animationTime: defines the interval to animate the indicator. It must be the same as the css transition timing value. Default: 200
  • increaseRate: pixel value that will be added to the indicator dimensions when the user is pressing the mouse. Default: 15
  • onRelease: callback to be executed when releaseTime is reached. Default: none (it will just reset the indicator)
  • releaseTime: time limit until the indicator is released. Default: 3000

Development

Release development tasks are managed by Grunt. To install all the necessary packages, just invoke:

npm install

These are the available grunt tasks:

  • js: runs jslint and jasmine tests and creates minified and concatenated versions of the script;
  • css: runs compass and csslint
  • test: runs jasmine tests, jslint and csslint
  • watch: watch for modifications on script/scss files

The source files are located inside the src directory. Release stylesheet was created using sass/compass, so make sure you have the compass gem installed on your system.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Test your changes to the best of your ability.
  4. Update the documentation to reflect your changes if they add or changes current functionality.
  5. Commit your changes (git commit -am 'Added some feature')
  6. Push to the branch (git push origin my-new-feature)
  7. Create new Pull Request

License

"THE BEER-WARE LICENSE" (Revision 42):

As long as you retain this notice you can do whatever you want with this stuff. If we meet some day, and you think this stuff is worth it, you can buy me a beer in return.

Bitdeli Badge

About

Release is a JavaScript plugin that enables the execution of an action after the user keeps the mouse pressed for a custom amount of time.

Resources

Stars

Watchers

Forks

Packages