Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
{menu}使用 jQuery ,当浏览器或窗口调整为较小的屏幕尺寸以进行响应式网页设计时,我需要删除此 html 代码和其中的标签。
{menu}
<div id="menu">{menu}</div>
我是 jQuery 新手,因此我们将不胜感激任何帮助或建议。
您不一定需要使用 jQuery,只需在样式表中添加媒体查询:
@media screen and (max-width:480px) { #menu { display: none; } }
这样,如果屏幕发生变化(例如变成横向,或者浏览器可能被调整大小),菜单将再次出现。