Advertisement
grappler

Opt-Out Responsive V1

Dec 22nd, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.08 KB | None | 0 0
  1. <!doctype html>
  2. <html lang="en" class="no-js responsive">
  3. <head>
  4.   <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
  6. <style type="text/css">
  7. .content { margin: 0 auto; }
  8. .responsive .content{ background:yellow; width: 70% }
  9. .responsive .fixed-width-link { display: block; }
  10. .responsive .responsive-link { display: none; }
  11. .fixed-width .content { background:red; width: 600px; }
  12. .fixed-width .fixed-width-link { display: none; }
  13. .fixed-width .responsive-link { display: block; }
  14. </style>
  15. </head>
  16. <body class="">
  17. <script type="text/javascript">
  18. (function(doc, classToAdd){
  19.    doc.className = (doc.className).replace("no-js", classToAdd);
  20. })(document.documentElement, "js");
  21. function FixedWidth() {
  22.     if (window.location.hash == "#fixed-width") {
  23.         (function(doc, classToAdd) {
  24.             doc.className = (doc.className).replace("responsive", classToAdd);
  25.         })(document.documentElement, "fixed-width");
  26.         viewport = document.querySelector("meta[name=viewport]");
  27.         viewport.setAttribute('content', 'width=device-width, user-scalable=yes, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0');
  28.     }
  29. }
  30. function Responsive() {
  31.     if (window.location.hash == "#responsive") {
  32.         (function(doc, classToAdd) {
  33.             doc.className = (doc.className).replace("fixed-width", classToAdd);
  34.         })(document.documentElement, "responsive");
  35.         viewport = document.querySelector("meta[name=viewport]");
  36.         viewport.setAttribute('content', 'width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0');
  37.     }
  38. }
  39. window.onload = FixedWidth;
  40. window.onload = Responsive;
  41. </script>
  42. <div class="content">
  43.     <h1 class="fixed-width-link">Responsive</h1>
  44.     <h1 class="responsive-link">Fixed Width</h1>
  45.     <a href="#fixed-width" onclick="return FixedWidth()" class="fixed-width-link">Fixed Width</a>
  46.     <a href="#responsive" onclick="return Responsive()" class="responsive-link">Reponsive</a>
  47. </div>
  48. </body>
  49. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement