Question

I've been working on a dropdown menu with Foundation, except my menu doesn't appear. Everytime I hover over the parent link, the drop down menu only appears after I hover over the area where the menu is supposed to be. Any ideas?

JS Fiddle: http://jsfiddle.net/hHP4q/

HTML:

<nav class="top-bar" data-topbar id="nav-bar">
        <ul class="left">
            <li class="nodrop"><a href="#">home</a></li>

        <li class="has-dropdown">
            <a href="#">SAT I</a>

            <ul class="dropdown">
                <li class="drop"><a href="#">Score a Test</a></li>

                <li class="drop"><a href="#">Past Tests</a></li>
            </ul>
        </li>

        <li><a href="#">SAT II</a></li>
    </ul>
</nav>

CSS:

.top-bar {
    width: 768px;
    margin: 0 auto;
    padding: 0;
    height: 50px;
    background-color: #518c52;
}

/* line 42, ../scss/styles.scss */
.top-bar ul {
    line-height: 50px;
    height: 50px;
}

/* line 45, ../scss/styles.scss */
.top-bar ul li {
    display: inline-block;
    float: left;
    width: 75px;
    transition: background-color 1s;
    -webkit-transition: background-color 1s;
    text-align: center;
    height: 50px;
}

/* line 53, ../scss/styles.scss */
.top-bar ul li a {
    font-size: 18px;
    color: #FFF;
}

/* line 58, ../scss/styles.scss */
.top-bar ul li:hover {
    height: 50px;
    background-color: #3e713f;
}

/* line 62, ../scss/styles.scss */
.top-bar ul .dropdown {
    width: 100px;
    margin: 0;
    padding: 0;
}

/* line 67, ../scss/styles.scss */
.top-bar ul .drop {
    width: 100px;
    margin: 0;
    padding: 0;
}
Was it helpful?

Solution

DEMO

What i did was hide ul inside .dropdown class li & reveal it on hover.

CSS:

.top-bar {
    width: 768px;
    margin: 0 auto;
    padding: 0;
    height: 50px;
    background-color: #518c52;
}
/* line 42, ../scss/styles.scss */
 .top-bar ul {
    line-height: 50px;
    height: 50px;
}
/* line 45, ../scss/styles.scss */
 .top-bar ul li {
    display: inline-block;
    float: left;
    width: 75px;
    transition: background-color 1s;
    -webkit-transition: background-color 1s;
    text-align: center;
    height: 50px;
    background-color: #518c52;
}
.top-bar ul li.has-dropdown ul {
    display:none;
}
.top-bar ul li.has-dropdown:hover ul {
    display:block;
}
/* line 53, ../scss/styles.scss */
 .top-bar ul li a {
    font-size: 18px;
    color: #FFF;
}
/* line 58, ../scss/styles.scss */
 .top-bar ul li:hover {
    height: 50px;
    background-color: #3e713f;
}
/* line 62, ../scss/styles.scss */
 .top-bar ul .dropdown {
    width: 100px;
    margin: 0;
    padding: 0;
}
/* line 67, ../scss/styles.scss */
 .top-bar ul .drop {
    width: 100px;
    margin: 0;
    padding: 0;
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top