jQuery Plugin To Emulate Apple's 3D Touch Functionality - Force Touch
File Size: | 4.48 KB |
---|---|
Views Total: | 611 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
Force Touch is a very small jQuery plugin which brings the Apple's 3D touch experience to your webpage. The plugin allows to trigger callback functions when you hold down on an element, without breaking any existing onClick functionality.
How to use it:
1. Load the latest version of jQuery library and the jQuery Force Touch plugin in your html page.
<script src="//code.jquery.com/jquery.min.js"></script> <script src="forcetouch.js"></script>
2. Active the 3D force functionality on the element.
$("#el").forcetouch();
3. Do something when the3D touch is triggered.
$("#el").forcetouch({ onstart: function(){ // ... } });
4. Do something when the 3D touch is ended.
$("#el").forcetouch({ onend: function(){ // ... } });
5. Do something when the 3D touch is ended.
$("#el").forcetouch({ onend: function(){ // ... } });
6. Change the default delay time.
$("#el").forcetouch({ delay: 100, });
This awesome jQuery plugin is developed by robfarr. For more Advanced Usages, please check the demo page or visit the official website.