24

I'm using SlikNav to make a mobile navigation menu. I have this structure:

<nav>
    <ul>
        <li>
            <a href="#">Home</a>
        </li>
        <li>
            <a href="#">Products</a>
            <ul>
                <li>
                    <a href="#">Child1</a>
                </li>
                <li>
                    <a href="#">Child2</a>
                </li>
            </ul>
        </li>
    </ul>
</nav>

This works fine on mobile view, here is a codepen.

My desktop version of this is simply: nav ul li { display:inline; } which makes the list display inline.

My question, is it possible for SlickNav to make the dropdown menu also work in desktop view?

M0nst3R
  • 5,186
  • 1
  • 23
  • 36
IMB
  • 15,163
  • 19
  • 82
  • 140

2 Answers2

1

right now, the menu is already a dropdown in desktop mode and also in mobile mode..

Just for looks good, do that - add a class "sub" in ul after li.

<nav>
  <ul>
    <li><a href="#">Home</a></li>
    <li><a href="#">Products</a>
      <ul class="sub">
        <li><a href="#">Child1</a></li>
        <li><a href="#">Child2</a></li>
      </ul>
    </li>
  </ul>
</nav>

and css -

li{
  float: left;
}
li > ul.sub{
  margin: 0;
}
0

I don't know how to do this but I have an alternative and fast solution from this.

You can use smartmenu Plugin Here is the Example Click Here Preview

Javascript Code

HTML Code

Hope It Helps You.

Neeraj Pathak
  • 759
  • 4
  • 13