<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 8 年前。
<分区>
编辑问题以包含 desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem .这将有助于其他人回答问题。
关闭 8 年前。
正如您在我的 website 上看到的那样,我的水平导航菜单太长,无法在使用 iPad 查看页面时与 Logo 位于同一行。
因此,我想根据视口(viewport)宽度缩短菜单项(即,如果视口(viewport)宽度 <= 768px,则使用“Coaching”而不是“Espace Coaching”。 是否可以?是否有用于此的 JS 插件? (在谷歌上没有找到任何东西)
最佳答案
这是一个非常简单的答案:http://jsfiddle.net/r5Ft9/4/
像这样使用 CSS:
@media screen and (min-width: 0px) and (max-width: 799px) {
.hide-on-small { display: none;}
}
HTML 是这样的:
<h1><span class="hide-on-small">Espace </span>Coaching</h1>
此外,以下 SO 问题包含带有 CSS 媒体查询断点的代码片段:Common CSS Media Queries Break Points
关于javascript - 根据视口(viewport)宽度显示不同的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24477803/
相关文章:
javascript - Highcharts 最小 y 轴值
javascript - 在 node.js 中发送带有图像附件的电子邮件
facebook - 在 Facebook 页面上发布一个小网页
jquery - 如何停止接收 : TypeError: $(. ..).attr(...) 未定义?
html - 我应该用什么代替 '-ms-appearance: checkbox'
javascript - 递归查找范围内加起来等于目标值的 n 个数字
javascript - 如何将自定义变量传递到 Promise 中,以跟踪用于调用函数的内容?