Code snippet for adaptive scaling of web pages on iPhone

From , 5 Years ago, written in JavaScript, viewed 166 times.
URL https://pastebin.vip/view/80a160ff
  1. <script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
  2. <script type="text/javascript">
  3. $(function(){
  4.   if (navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i)) {
  5.     var viewportmeta = document.querySelector('meta[name="viewport"]');
  6.       if (viewportmeta) {
  7.         viewportmeta.content = 'width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0';
  8.         document.addEventListener('touchstart', function () {
  9.           viewportmeta.content = 'viewportmeta.content = width=device-width, minimum-scale=0.25, maximum-scale=1.6';
  10.         }, false);
  11.           document.addEventListener('orientationchange', function () {
  12.           viewportmeta.content = 'viewportmeta.content = width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0';
  13.         }, false);
  14.       }
  15.    }
  16. });
  17. </script>
  18.  
  19.  
  20. //javascript/5127

Reply to "Code snippet for adaptive scaling of web pages on iPhone"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website