use*_*313 4 jquery screen-resolution
我希望div类'content'的大小根据用户屏幕分辨率的大小而改变.
到目前为止我写了这个javascript
function resize()
{
if ((screen.width>1024)) { $(".content").style.width = 560 + "px"; $(".content").style.height = 315 + "px" }
if ((screen.width>1280)) { $(".content").style.width = 640 + "px"; $(".content").style.height = 360 + "px" }
else { $(".content").style.width = 853 + "px"; $(".content").style.height = 480 + "px" }
};
Run Code Online (Sandbox Code Playgroud)
显然在html中我有类'.content'
为什么这段代码不起作用?
| 归档时间: |
|
| 查看次数: |
27569 次 |
| 最近记录: |