Advertisement
grappler

Opt-Out Responsive V2

Dec 23rd, 2012
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!doctype html>
  2. <html lang="en" class="no-js">
  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="responsive">
  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.     (function(body, classToAdd) {
  23.         body.className = (body.className).replace("responsive", classToAdd);
  24.     })(document.body, "fixed-width");
  25.     viewport = document.querySelector("meta[name=viewport]");
  26.     viewport.setAttribute('content', 'width=device-width, user-scalable=yes, initial-scale=1.0');
  27. }
  28. function Responsive() {
  29.     (function(body, classToAdd) {
  30.         body.className = (body.className).replace("fixed-width", classToAdd);
  31.     })(document.body, "responsive");
  32.     viewport = document.querySelector("meta[name=viewport]");
  33.     viewport.setAttribute('content', 'width=device-width, user-scalable=no, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0');
  34. }
  35. window.onload = FixedWidth;
  36. window.onload = Responsive;
  37. </script>
  38. <div class="content">
  39.     <h1 class="fixed-width-link">Responsive</h1>
  40.     <h1 class="responsive-link">Fixed Width</h1>
  41.     <a href="#" onclick="return FixedWidth()" class="fixed-width-link">Fixed Width</a>
  42.     <a href="#" onclick="return Responsive()" class="responsive-link">Reponsive</a>
  43. </div>
  44. </body>
  45. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement