0
我的页面上有一个包含图像的div。由于它的高度为800像素,距离页面底部400像素,因此在较小的显示器上观看时,图像会从顶部切断。我没有在我的网站上使用滚动条。检测屏幕尺寸的脚本/代码
我增加了一些CSS来我的div缩小/缩放内容...
.hello {
width:100%;
height:800px;
position:fixed;
top:0;
bottom-margin:400px;
z-index:0;
-moz-transform: scale(.8);
-webkit-transform: scale(.8);
zoom : .8;
-moz-transform-origin:top center;
-webkit-transform-origin:top center;
}
不过是没有办法,我可以实现任何脚本仅适用变焦/规模,如果用户的显示器尺寸是1200px或更小?
在此先感谢您的帮助!
感谢您的回复。我如何去使用Javascript将CSS类应用于div?我愿做这样的事情:如果(window.innerHeight <= 1200) { APPLY “HELLO” 类DIV } 其他 { APPLY “HELLO2” 类DIV } – user974254 2013-03-20 03:59:48
@ user974254 - HTTP: //stackoverflow.com/questions/195951/change-an-elements-css-class-with-javascript – tjameson 2013-03-20 05:35:08