Created
June 6, 2018 08:50
-
-
Save barsbek/df3ecf087009bd02d5419736a81e9fcb to your computer and use it in GitHub Desktop.
scale desktop version depending on device width
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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