zl程序教程

您现在的位置是:首页 >  前端

当前栏目

javascript检测页面是否缩放的小例子

JavaScript 页面 是否 检测 例子 缩放
2023-06-13 09:14:54 时间
复制代码代码如下:

/*
 *zoomCheck
 */
jQuery(function($){
 vardCheck=$("#zoomCheck");
 if(dCheck.size()!=0){
   return;
 }
 dCheck=$("<span></span>").attr("id","zoomCheck").css({
   position:"fixed",
   left:"5px"
 }).hide().appendTo("body");
 vartime;
 time=setInterval(function(){
   dCheck.show();
   varleft=dCheck.position().left;
   dCheck.hide();
   if(left!=5){
     clearInterval(time);
     alert("你的页面处于缩放状态,页面显示会有问题,请设置为正常状态。windows:ctrl+0  mac:command+0");
   }
 },2000);
});