Skip to content

Commit

Permalink
add vibrate feature detection for mobile browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
Darius Morawiec committed Mar 26, 2012
1 parent b0c7dfc commit b7fcccf
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions feature-detects/vibrate.js
Original file line number Diff line number Diff line change
@@ -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;
});

0 comments on commit b7fcccf

Please sign in to comment.