利用zoom 实现不同分辨率展示

目录


注意:此zoom 直接添加到body上,所以整个内容都会缩放(谨慎使用)

核心方法

function getWindowSize(){
	let windowWidth=$(window).width();
	let windowHeigh=$(window).height();
	if(!detectIE()){ //detectIE() 判断是否是ie,自行百度方法
		if(windowWidth<=900){
			windowWidth=900;
			$('body').css({'width':documentWidth});	
		}
		zoomScale=windowWidth/documentWidth;
		$('body').css({'zoom':zoomScale});
	}else{
		zoomScale=1;
		windowWidth=1900;
	}
}

调用

getWindowSize();
$(window).bind('resize',function(){getWindowSize()});

转载自:https://blog.csdn.net/qq_37026254/article/details/88708080

You may also like...

退出移动版