简体   繁体   中英

Foundation top-bar breaks when loading another page

I am currently building a small website using ruby on rails and foundation as the css framework. I implemented a top bar for navigation with 2 items being nested drop downs.

Here is the code of the top-bar that is inside my layout/application.html.erb:

<body>
    <div class="top-bar">
    <div class="top-bar-left">
        <ul class="dropdown menu" data-dropdown-menu>
            <li class="menu-text">Logo</li>
            <li><a href="/">Home</a></li>
            <li><a href="/stats">Statistics</a></li>
            <li><a href="/news">News</a></li>
            <li><a href="/items">Items</a>
                <ul class="menu">
                    <li><a href="#">Infected items</a></li>
                    <li><a href="#">Detective items</a></li>
                </ul>
            </li>
            <li><a href="/guides">Guides</a>
                <ul class="menu">
                    <li><a href="#">Lore</a></li>
                    <li><a href="#">Beginner tutorial</a></li>
                    <li><a href="#">Mod rules</a></li>
                    <li><a href="#">Strategy guide</a></li>
                    <li><a href="#">How to be a good detective?</a></li>
                </ul>
            </li>



        </ul>
    </div>
</div>

As shown in the following picture:

工作顶杆

The code behaves as intended until I open the statistics page right next to home, as shown in this one:

顶杆损坏

If I enter the stats page manually, I get no problems until I switch back to home. This happens anytime I click a link of the top bar that is not the same page that I currently am at.

I currently have no custom javascript or jQuery listeners implemented at all and I'm using a fresh foundation installation using foundation-rails.

Why is this happening and how can I solve it? Is it related to rails?

Thank you

This was due to a conflict between foundation and turbolinks.

For anyone running into this kind of apparently random issues, I solved this by following the approach suggested here:

http://foundation.zurb.com/forum/posts/2348-foundation-5-topbar-menu-not-responding-on-rails4

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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