【发布时间】:2014-12-04 11:40:45
【问题描述】:
当用户将浏览器窗口的宽度调整为小于 990 像素时,我想隐藏一个元素并显示另一个元素。
当窗口宽度小于 990px 时隐藏 largeElement
当窗口宽度小于 990px 时显示 smallElement
<div id="largeElement" style="width:900px;height:100px;background-color:#cc9966"></div>
<div id="smallElement" style="display:none;width:300px;height:100px;background-color:#39c"></div>
有谁知道可以做到这一点的 javascript(不是 jQuery)吗?
【问题讨论】:
标签: javascript browser window hide show