Description
This library was to be published hand-to-hand with my article on the Vibration API. You can also view the documentation.
jquery.vibrate.js alternatives and similar libraries
Based on the "Misc" category.
Alternatively, view jquery.vibrate.js alternatives based on common mentions on social networks and blogs.
-
list.js
The perfect library for adding search, sort, filters and flexibility to tables, lists and various HTML elements. Built to be invisible and work on existing HTML. -
InversifyJS
A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript. -
Autotrack
DISCONTINUED. Automatic and enhanced Google Analytics tracking for common user interactions on the web. -
mixitup
A high-performance, dependency-free library for animated filtering, sorting, insertion, removal and more -
surveyjs
Free Open-Source JavaScript form builder library with integration for React, Angular, Vue, jQuery, and Knockout that lets you load and run multiple web forms, or build your own self-hosted form management system, retaining all sensitive data on your servers. You have total freedom of choice as to the backend, because any server + database combination is fully compatible.
InfluxDB - Purpose built for real-time analytics at any scale.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of jquery.vibrate.js or a related project?
README
This library was to be published hand-to-hand with my article on the Vibration API. You can also view the documentation.
Does my Device Support the API?
The vibration API is implemented in navigator.vibrate
. So calling the function makes your phone vibrate. You can test if your browser is recent enough to have the vibrate
function in navigator
.
Mozilla had their own implementation mozVibrate
so some browsers may support that instead.
var canVibrate = "vibrate" in navigator || "mozVibrate" in navigator;
if (canVibrate && !("vibrate" in navigator))
navigator.vibrate = navigator.mozVibrate;
However, this doesn't mean that your device can vibrate. Just that it's recent enough. There are a few requirements you need to meet.
- You need the hardware for it.
- The page needs to be visible.
- Browser-specific implementation prevents the vibration.
Usage
jquery.vibrate.js
You can embed using bower with bower install jquery.vibrate.js
. Or you can download the zip file and extract the build/jquery/* files.
The javascript files are located in build/jquery/jquery.vibrate.min.js.
Download and embed the code then initialize in one of the following ways.
// Vibration for 50ms on all .button on click
$(".button").vibrate();
// Vibrate for 20ms on click
$(".button").vibrate("short");
// Vibrate for 50ms on click
$(".button").vibrate("medium");
$(".button").vibrate("default");
$(".button").vibrate(50);
// Vibrate for 100ms on click
$(".button").vibrate("long");
// Vibrate for 40ms on touchstart
$(".button").vibrate({
duration: 40,
trigger: "touchstart"
});
// Vibrate twice
$(".button").vibrate({
pattern: [20, 200, 20]
});
Development
I'm using grunt and node for building the docs. Grunt and jasmine for testing. Check out the gruntfile.