简体   繁体   中英

Zoom the page using JavaScript

How to zoom in/out a page using JavaScript?

= please but comments to explain the code =

function ZoomIn()
{
    var Page = document.getElementById('Body');
    var zoom = parseInt(Page.style.zoom) + 50 +'%'
    Page.style.zoom = zoom;
    return false;
}

function ZoomOut()
{
    var Page = document.getElementById('Body');
    var zoom = parseInt(Page.style.zoom) - 50 +'%'
    Page.style.zoom = zoom;
    return false;
}

try this

function ajustaZoom() {
        document.body.style.zoom = "67%" 
    }

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