Skip to content

Instantly share code, notes, and snippets.

@barsbek
Created June 6, 2018 08:50
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 barsbek/df3ecf087009bd02d5419736a81e9fcb to your computer and use it in GitHub Desktop.
Save barsbek/df3ecf087009bd02d5419736a81e9fcb to your computer and use it in GitHub Desktop.
scale desktop version depending on device width
if( true ) {
var ww = ( $(window).width() < window.screen.width ) ? $(window).width() : window.screen.width; //get proper width
var mw = 1024;
var ratio = ww / mw;
if( ww < mw){
$('#viewport').attr('content', 'initial-scale=' + ratio + ', maximum-scale=' + ratio + ', minimum-scale=' + ratio + ', user-scalable=yes, width=' + ww);
}else{
$('#viewport').attr('content', 'initial-scale=1.0, maximum-scale=2, minimum-scale=1.0, user-scalable=yes, width=' + ww);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment