I have a responsive site with a desktop width > 980px and a mobile width < 768px. I want tablets to view the site at a 980px viewport, but mobile to view at device width.
Specifically, I want the following:
width = device width
if width >= 768px
viewport = 980px
else
viewport = width
What is the best way to approach this problem? I don’t want to check the useragent on the server.
From what I understand, you want to do this:
and from what I tested, that works. (Which is a bit funny, because the viewport is written after the document ‘loaded’; you may see a little jump on screen, and YMMV.)
— EDIT
nowadays i just write this code in the head, like this
which is what monaca does, so I guess its ok
https://github.com/monaca/monaca.viewport.js/tree/master