Javascript & JQuery & CSS > example - 화면확대 축소 스크립트
등록일 : 2019-04-04 16:21
조회수 : 260,456
var nowZoom = 100;
function zoomIn() {
nowZoom = nowZoom - 10;
if(nowZoom <= 70) nowZoom = 70;
zooms();
}
function zoomOut() {
nowZoom = nowZoom + 20;
if(nowZoom >= 500) nowZoom = 500;
zooms();
}
function zoomReset(){
nowZoom = 100;
zooms();
}
function zooms(){
$("body").css("zoom",nowZoom1);
//또는
//document.body.style.zoom = nowZoom + '%';
if(nowZoom==70){
alert ("30% 축소 되었습니다. 더 이상 축소할 수 없습니다.");
}
if(nowZoom==500){
alert ("500% 확대 되었습니다. 더 이상 확대할 수 없습니다.");
}
}
화면확대 축소 스크립트 예제 입니다.