简体   繁体   English

手机/台式机的不同菜单

[英]Different menus for mobile/desktop

so I'm using Bootstrap and working on different menus for desktop/tablet and mobile. 所以我正在使用Bootstrap并在台式机/平板电脑和移动设备的不同菜单上工作。 I have a regular top-fixed navbar for desktop/tablet and a couple of the tabs are drop-down menus with multiple columns making it illogical to use this for mobile, so I'm doing a slide push menu for that. 我在台式机/平板电脑上有一个固定的顶部固定导航栏,其中几个选项卡是带有多列的下拉菜单,因此将其用于移动设备是不合逻辑的,因此我为此做了一个幻灯片推送菜单。 Can anyone point me in the general direction of how to do so efficiently? 任何人都可以指出我如何有效地这样做的总体方向吗? I know how to implement the menus themselves, it's just facilitating which is shown for their respective devices. 我知道如何自己实现菜单,只是为了方便显示各自设备的菜单。 Would I need to use media queries and display:none for the respective menus, or possibly a JS if statement? 我是否需要使用媒体查询和display:none分别菜单或JS if语句? Would the latter cause mobile versions to load the site slower to a point where it isn't feasible as the other menu is extensive? 后者会导致移动版本将网站加载速度降低到某个程度,以至于其他菜单太宽泛时,这是不可行的?

I've searched SE, and found an answer but it was for WP only so didn't really help, but it utilized an if statement. 我已经搜索了SE,找到了答案,但是它仅用于WP,因此并没有真正的帮助,但是它使用了if语句。 Thanks for your help! 谢谢你的帮助!

If you are using Bootstrap, there are class that you can use to tell a part is hidden depending on the screen's width. 如果您使用的是Bootstrap,则可以根据屏幕的宽度使用某些类来告知部件是否隐藏。

These class are hidden-xs , hidden-sm and so on. 这些类是hidden-xshidden-sm等。

See this on the bootstrap documentation : http://getbootstrap.com/css/#responsive-utilities 请参阅引导程序文档: http : //getbootstrap.com/css/#响应实用程序

使用display : none媒体查询功能将完成此任务,并且不会在移动版本中引起任何问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM