Using jquery to determine screen width
JQuery uses $(window).width()
. It's a function, not a property.
iPhone6 screen is 1334x750 pixels. If you only use the width to detect mobile user, see this instead.
The iPhone 6 display has a resolution of 1334x750. When emulating iPhone6 in chrome dev tools the width is reported as 980
(I don't know if this is accurate).
You might be interested in this: http://detectmobilebrowsers.com/
Also, as others have noted, replace $(window).width
with $(window).width()
Well, ignoring what ekuusela said about screen resolution, you seem to have forgotten your parentheses after width
, which is a method, not a field. To fix this, just add ()
after it:
if ($(window).width() < 700)
See the documentation for width()
for more info.