萬盛學電腦網

 萬盛學電腦網 >> 腳本專題 >> javascript >> javascript檢測頁面是否縮放

javascript檢測頁面是否縮放

 /*
* zoomCheck
*/
jQuery(function($){
var dCheck = $("#zoomCheck");
if(dCheck.size() != 0){
return;
}
dCheck = $("<span></span>").attr('id',"zoomCheck").css({
position :'fixed',
left : '5px'
}).hide().appendTo('body');
var time;
time = setInterval(function(){
dCheck.show();
var left = dCheck.position().left;
dCheck.hide();
if(left != 5){
clearInterval(time);
alert('你的頁面處於縮放狀態,頁面顯示會有問題,請設置為正常狀態。windows:ctrl+0 mac:command+0');
}
},2000);
});

copyright © 萬盛學電腦網 all rights reserved