3

I'm trying to create a top menu with a dropdown submenu function. I want to target the list items witch have a submenu (child element) attached to it. So that i can style them with a different color list style etc.

HTML:

<nav>
    <ul><div id="logo">
            <img src="images/design/logo.png" alt="Logo for responsive template" />
        </div>
        <li>Home</li>
        <li>Parrent Link
            <ul>
                <li>Child Link</li>
                <li>Child Link</li>
                <li>Parrent Link
                    <ul>
                        <li>Child Link</li>
                        <li>Child Link</li>
                        <li>Child Link</li>
                        <li>Child Link</li>
                        <li>Child Link</li>
                    </ul>
                </li>
            </ul>
        </li>
        <li>About</li>
        <li>Gallery</li>
        <li>Contact</li>
    </ul>
</nav>

So each Parrent link get another style than the rest.

Legarndary
  • 957
  • 2
  • 16
  • 37
  • Take a look at this post http://stackoverflow.com/questions/5281556/is-there-a-css-way-to-add-an-arrow-if-a-ul-has-a-ul-child – Filip Huysmans Jan 13 '14 at 15:15
  • @Legarndary Take a look at my solution. Is it helpful? – Itay Gal Jan 13 '14 at 17:46
  • @ItayGal Yes, it was very helpfuf, it does the trick. If somebody else wanne use this but not wanna target the first parrent just replace "if(parent.is('li')){" with "if(parent.is('ul li ul li')){" – Legarndary Jan 14 '14 at 10:00