Advertisement
Guest User

Untitled

a guest
Sep 24th, 2013
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.80 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title></title>
  5. </head>
  6. <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
  7. <script type="text/javascript">
  8. window.onload = function() {
  9. var currFFZoom = 1;
  10. var currIEZoom = 100;
  11.  
  12. $('#In').on('click',function(){
  13.     if (navigator.userAgent.indexOf('Firefox') != -1 && parseFloat(navigator.userAgent.substring(navigator.userAgent.indexOf('Firefox') + 8)) >= 3.6){//Firefox
  14.        var step = 0.02;
  15.         currFFZoom += step;
  16.         $('body').css('MozTransform','scale(' + currFFZoom + ')');
  17.     }else if(navigator.userAgent.indexOf('Opera') != -1) {
  18.         var step = 0.02;
  19.         currFFZoom += step;
  20.         $('body').css('-webkit-transform','scale(' + currFFZoom + ')');
  21.     }
  22.     else {
  23.         var step = 2;
  24.         currIEZoom += step;
  25.         $('body').css('zoom', ' ' + currIEZoom + '%');
  26.     }
  27.     console.log(currFFZoom);
  28. });
  29.  
  30. $('#Out').on('click',function(){
  31.     if (navigator.userAgent.indexOf('Firefox') != -1 && parseFloat(navigator.userAgent.substring(navigator.userAgent.indexOf('Firefox') + 8)) >= 3.6){//Firefox
  32.        var step = 0.02;
  33.         currFFZoom -= step;                
  34.         $('body').css('MozTransform','scale(' + currFFZoom + ')');
  35.  
  36.     }else if(navigator.userAgent.indexOf('Opera') != -1) {
  37.         var step = 0.02;
  38.         currFFZoom -= step;
  39.         $('body').css('-webkit-transform','scale(' + currFFZoom + ')');
  40.     } else {
  41.         var step = 2;
  42.         currIEZoom -= step;
  43.         $('body').css('zoom', ' ' + currIEZoom + '%');
  44.     }
  45.     console.log(currIEZoom);
  46. });};  
  47. </script>
  48. <body>
  49.  
  50. asjhkdlabfhdsabfalhsdf ph aspfh sapf
  51. <div style=”zoom: 400%”>This is x2 text </div>
  52. <input type="button" id="Out" alt="Zoom Out" value="-" />
  53. <input type="button" id="In" alt="Zoom In" value="+" />
  54. </body>
  55. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement