Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Form factor detection in JavaScript (tablet vs phone) w/ jQuery
var _w = Math.max( $(window).width(), $(window).height() );
var _h = Math.min( $(window).width(), $(window).height() );
// assume tablet view based upon display resolution
var tabletView = (_w >= 1000 && _h >= 600);
if ( tabletView ) {
//Setup the tablet form factor via JS
else {
//Setup the phone form factor via JS
Copy link

matthewhall-ca commented Feb 6, 2013

Works great with iPhones and iPads, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment