简体   繁体   English

与基础顶部并排放置两个菜单的最佳方法是什么

[英]What's the best way to have two menus side by side with foundations top-bar

I want to have two separate menus on the right side but right next (not stacked) to each other. 我想在右侧有两个单独的菜单,但彼此之间要紧挨着(不堆叠)。

The only thing that has worked for me (and I've tried ALOT) is the following code, which involves me using top-bar-right twice, and feel like there must be a better way and it seems to be causing a tiny twitch each time the page is reloaded. 唯一对我有用(并且我已经尝试过很多)的代码是以下代码,其中涉及我两次使用top-bar-right,并且感觉必须有更好的方法,并且似乎会引起微小的抽动每次重新加载页面时。

http://codepen.io/anon/pen/MKqzaG (the dropdown doesn't work here but it does on my machine. http://codepen.io/anon/pen/MKqzaG (下拉菜单在这里不起作用,但在我的计算机上有效。

<nav class="top-bar">
  <div class="top-bar-left">
    <ul class="menu">
      <li class="menu-text">JamNet</li>
      <li><input type="search" placeholder="Search"></li>
      <li><button type="button" class="button">Search</button></li>
    </ul>
  </div>
  <div class="top-bar-right">
    <ul class="menu">
      <li><a href="#">1</a></li>
      <li><a href="#">1</a></li>
      <li><a href="#">1</a></li>
      <li data-toggle="example-dropdown2"><a>v</a></li>
      <ul class="dropdown-pane top" id="example-dropdown2" data-dropdown>
        <li><a href="#">1</a></li>
        <li><a href="#">1</a></li>
        <li><a href="#">1</a></li>
      </ul>
    </ul>
  </div>
  <div class="top-bar-right">
    <ul class="menu">
      <li><a href="#">2</a></li>
      <li><a href="#">2</a></li>
      <li><a href="#">2</a></li>
    </ul>
  </div>
</nav>

Make sure you use the dropdown class in the list. 确保使用列表中的下拉类。 Then add as many list items as you want. 然后根据需要添加任意数量的列表项。 Once the end of the visible screen is reached the list items and their contents will wrap (stack). 一旦到达可见屏幕的末尾,列表项及其内容将自动包装(堆叠)。 Your codepen is missing foundation.js and the code to start foundation. 您的Codepen缺少Foundation.js和启动Foundation的代码。 Here is a fork to your codepen: http://codepen.io/chris0/pen/QGGMpR 这是您的Codepen的分支: http ://codepen.io/chris0/pen/QGGMpR

Here is a solution to your specific question (style as desired): 这是您的特定问题(所需样式)的解决方案:

<nav class="top-bar">
    <div class="top-bar-left">
        <ul class="dropdown menu" data-dropdown-menu>
            <li class="menu-text">JamNet</li>
            <li><input type="search" placeholder="Search"></li>
            <li><button type="button" class="button">Search</button></li>
        </ul>
    </div>
    <div class="top-bar-right">
        <ul class="dropdown menu" data-dropdown-menu>
            <li>
                <a href="#" style="text-decoration: none;" onclick="return false;">DropDown1</a>
                <ul class="submenu menu vertical" data-submenu>
                    <li><a href="#">DD1a</a></li>
                    <li><a href="#">DD1b</a></li>
                </ul>
            </li>

            <li>
                <a href="#" style="text-decoration: none;" onclick="return false;">DropDown2</a>
                <ul class="submenu menu vertical" data-submenu>
                    <li><a href="#">DD2a</a></li>
                    <li><a href="#">DD2b</a></li>
                    <li><a href="#">DD2c</a></li>
                </ul>
            </li>
        </ul>
    </div>
</nav>

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

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