Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/derrickreimer/jquery-longclick
A jQuery plugin for facilitating long button clicks
https://github.com/derrickreimer/jquery-longclick
Last synced: 5 days ago
JSON representation
A jQuery plugin for facilitating long button clicks
- Host: GitHub
- URL: https://github.com/derrickreimer/jquery-longclick
- Owner: derrickreimer
- License: mit
- Created: 2015-07-03T22:09:44.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-02T03:19:16.000Z (almost 9 years ago)
- Last Synced: 2024-10-30T00:37:13.028Z (about 2 months ago)
- Size: 2.93 KB
- Stars: 3
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Longclick
A jQuery plugin for long button clicks. Extracted from
[Codetree](https://codetree.com), inspired by UI patterns found
in [Zapier](https://zapier.com).## Usage
Some buttons lead to particularly destructive actions (like the classic "Delete"
button). One common way to help users avoid accidentally perform a destructive
action is to prompt them with an "Are you sure?" dialog box.This plugin helps you employ an alternative strategy: the long button click.
When a user pushes down on a long click button, this plugin can automatically
swap out the button text for something like "Hold to delete...". If the user
continues to hold down the button for a set duration of time (default of 1
second), then a `longclick` event will be fired.```javascript
$("#delete-button").longclick({
holdText: "Hold to delete...", // default: "Hold..."
heldText: "Deleting...", // default: null (will revert back to original text)
duration: 1000 // default: 1000
}).on("longclick", function() {
// do something
})
```## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request