简体   繁体   English

使用JS添加或删除菜单项以按屏幕尺寸下拉

[英]Add or Remove menu items to drop down with screen size using JS

How to add menu items to a drop down depending on the screen size using 如何使用屏幕尺寸将菜单项添加到下拉菜单中

jQuery jQuery的

Say i have a menu with eight items. 说我有一个包含八个项目的菜单。 When the eight item fit on the screen in one line then it' ok . 当八项内容在屏幕上排成一行时,就可以了。 But when i re-size the screen the only item/items 但是当我重新调整屏幕大小时, 唯一的项目

that do not fit in the screen in one line should form a drop-down. 屏幕上一行不适合的内容应形成一个下拉列表。 when i enlarge again the screen the menu item should come back one by one & the drop-down should disappear when all the items are fit in the screen . 当我再次放大屏幕时,菜单项应该一个接一个地返回,并且当所有项目都适合屏幕时,下拉菜单应该消失。

On an iphone/ipad etc it may even fit only 2/3 items or so, and the rest should form into a dropdown, dependent on the screen size. 在iphone / ipad等设备上,它甚至可能只适合2/3左右的物品,其余的物品会根据屏幕尺寸而变成下拉菜单。

see the link: 看到链接:

http://1drv.ms/1OGYCgS http://1drv.ms/1OGYCgS

I think bootstrap might be a nice alternative for this. 我认为引导程序可能是一个不错的选择。 Sorry if you have considered this and wanted to avoid it. 抱歉,如果您已经考虑过并希望避免这种情况。 If you resize the result window, you should see what your after. 如果您调整结果窗口的大小,则应该看到之后的内容。

You can also specify screen sizes which is then useful, for cross platform availability 您还可以指定有用的屏幕尺寸,以实现跨平台可用性

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

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