打开下拉菜单中的html标签

时间:2022-02-09 11:20:59

In a parent div, there is a "menu div" as I have shown in the picture. By clicking on the "menu" and a function in javascript, another window opens that contains the menu items.

在父div中,有一个“菜单div”,如图中所示。通过单击“菜单”和javascript中的函数,将打开另一个包含菜单项的窗口。

As it is presented, the "menu window" exceeds the parent div margins. For the menu part, I have considered two different tags. One when it is in the parent div and the other when it opens with the menu items and with padding and margin settings in css I have put them exactly in the same position so that when the window opens, the observer does not recognize any displacement for "MENU".

如图所示,“菜单窗口”超出了父div边距。对于菜单部分,我考虑了两个不同的标签。一个当它在父div中而另一个当它打开菜单项并且在css中使用填充和边距设置时我将它们精确地放在相同的位置,这样当窗口打开时,观察者不会识别任何位移“菜单”。

Is there a simpler way to do this? Can I have only one tag for MENU?打开下拉菜单中的html标签打开下拉菜单中的html标签

有更简单的方法吗? MENU我只能有一个标签吗?

1 个解决方案

#1


0  

Yes there is a simpler way than using 2 different menu tags.

是的,有一种比使用2种不同菜单标签更简单的方法。

You will have 1 menu tag (with some test for the menu) and put your menu items inside your menu tag (but don't display them - display:none). When user clicks on the menu, change the display of your items to block (display:block) and make sure your menu will show the items outside it's original size.

您将有1个菜单标签(对菜单进行一些测试)并将菜单项放在菜单标签内(但不显示它们 - 显示:无)。当用户点击菜单时,将项目的显示更改为阻止(显示:阻止),并确保您的菜单将显示其原始大小之外的项目。

#1


0  

Yes there is a simpler way than using 2 different menu tags.

是的,有一种比使用2种不同菜单标签更简单的方法。

You will have 1 menu tag (with some test for the menu) and put your menu items inside your menu tag (but don't display them - display:none). When user clicks on the menu, change the display of your items to block (display:block) and make sure your menu will show the items outside it's original size.

您将有1个菜单标签(对菜单进行一些测试)并将菜单项放在菜单标签内(但不显示它们 - 显示:无)。当用户点击菜单时,将项目的显示更改为阻止(显示:阻止),并确保您的菜单将显示其原始大小之外的项目。