From b7fcccf306b1d0145123c6b2085a27eb7e9aa61b Mon Sep 17 00:00:00 2001 From: Darius Morawiec Date: Mon, 26 Mar 2012 14:07:22 +0200 Subject: [PATCH] add vibrate feature detection for mobile browsers --- feature-detects/vibrate.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 feature-detects/vibrate.js diff --git a/feature-detects/vibrate.js b/feature-detects/vibrate.js new file mode 100644 index 0000000000..758d789f18 --- /dev/null +++ b/feature-detects/vibrate.js @@ -0,0 +1,9 @@ +// https://developer.mozilla.org/en/DOM/window.navigator.mozVibrate + +Modernizr.addTest('vibrate',function(){ + for (p in Modernizr._domPrefixes){ + if( window.navigator[Modernizr._domPrefixes[p].toLowerCase()+'Vibrate']) + return true; + } + return !!window.navigator['vibrate'] || false; +}); \ No newline at end of file