简体   繁体   中英

How to zoom webpage body using jquery in mozilla firefox

I have webpage and i want to zoom its body whenever it load using jquery but css zoom feature not working for mozilla firefox. Currently Using

$("body").css("zoom", "1.05");

It worked in chrome , opera ,edge but not working in firefox

Since zoom css doesn't working in mozilla, i try this

$("body").css("MozTransform","scale("+1.05+")");

But it didn't work . It will be great help if you give me solution .

You can try this

<script type="text/javascript">
        function zoomin() {
            document.body.style.zoom = "50%" 
        }
</script>

<body onload="zoomin()">
<h1>Whatever</h1>
</body>

Here is another answer for all modern browsers

$('body').css({
  'transform'                : 'scale(1.05)',
  'transform-origin'         : '0 0',
  '-moz-transform-origin'    : '0 0',         /*Firefox*/
  '-ms-transform-origin'     : '0 0',         /*IE*/
  '-webkit-transform-origin' : '0 0',         /*Opera/Safari*/
  '-moz-transform'           : 'scale(1.05)', /*Firefox*/
  '-ms-transform'            : 'scale(1.05)', /*IE*/
  '-webkit-transform'        : 'scale(1.05)'  /*Opera/Safari*/
});

Note : You can also define CSS zoom property like as above code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM