Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <meta id='viewport' name="viewport" content="width=480, height=640,initial-scale=1, maximum-scale=1, user-scalable=no" />
- <script>
- //Get meta tag
- var meta = document.getElementById('viewport');
- var scaleAmount = 1;
- var width = window.outerWidth;
- var height = window.outerHeight;
- if(window.outerWidth > window.outerHeight)
- {
- width = window.outerHeight;
- height = window.outerWidth;
- }
- var border = 1;
- var windowWidth = width - (border * 2);
- var windowHeight = height - (border * 2);
- var widthRatio = windowWidth / 480;
- var heightRatio = windowHeight / 640;
- if(widthRatio < heightRatio)
- {
- scaleAmount = widthRatio;
- }
- else
- {
- scaleAmount = heightRatio;
- }
- meta.setAttribute('content','width=480,height=640,initial-scale='+scaleAmount+', maximum-scale='+scaleAmount+', user-scalable=no');
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement