vadikom / smartmenus

Advanced jQuery website menu plugin. Mobile first, responsive and accessible list-based website menus that work on all devices.
http://www.smartmenus.org
MIT License
594 stars 164 forks source link

Open page on pages with sub-links #249

Open lottaar opened 6 months ago

lottaar commented 6 months ago

Is there any way in version 2 to open linked pages on items that have sub-links? For example by separating the text from the arrow, or clicking twice?

vadikom commented 6 months ago

Hi, yes. This is a nav item that acts just as a sub toggler (even if you set an actual URL in the href):

<li class="sm-nav-item">
  <a class="sm-nav-link sm-sub-toggler" href="#">Sub</a>
  <ul class="sm-sub">
    ...

And here is a "split" item that has a separate link part and a sub toggler part (a separate button element):

<li class="sm-nav-item">
  <a class="sm-nav-link sm-nav-link--split" href="#">Link</a>
  <button class="sm-nav-link sm-nav-link--split sm-sub-toggler" aria-label="Toggle sub menu"></button>
    <ul class="sm-sub">
      ...

The same logic is supported for sub items (you just need to use the sm-sub-item/sm-sub-link/sm-sub-link--split classes instead).