Skip to content

Instantly share code, notes, and snippets.

@ambienttraffic
Created September 5, 2014 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ambienttraffic/6cc5ea80ce5c2475c99a to your computer and use it in GitHub Desktop.
Save ambienttraffic/6cc5ea80ce5c2475c99a to your computer and use it in GitHub Desktop.
viewport meta tag hack
// Check to see if the screen is less than 768 px; add viewport tag if true.
// For displaying the full width site on tablets; tablet handles shrinking the layout to fit
if(window.outerWidth < 768) {
var ele = document.createElement("meta");
ele.name = "viewport";
ele.content = "width=device-width, initial-scale=1.0";
document.head.appendChild(ele);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment