Start a new discussion

To start a new discussion please visit the discussions section of the GitHub home page of the project.

Discussions on GitHub

You can also search our old self-hosted forums for any useful information below but please note that posting new content here is not possible any more.

Reply To: collapsibleBehavior: accordion BUT if link is only # (hash) open the child

Home Forums Latest release 1.1.x collapsibleBehavior: accordion BUT if link is only # (hash) open the child Reply To: collapsibleBehavior: accordion BUT if link is only # (hash) open the child

#3720
admin
Keymaster

Hi, could be achieved in different ways but here’s what I came up with at the moment:

1) First use collapsibleBehavior: 'accordion-link' instead.

2) Then use the following additional JS:

// SmartMenus jQuery - for href="#" items, expand sub menu (if available) on first tap
$('#main-menu').on('select.smapi', function(e, item) {
  var obj = $(this).data('smartmenus'),
      $item = $(item);
  if (obj.isCollapsible() && $item.is('[href="#"]')) {
    var $sub = $item.dataSM('sub');
    if ($sub && !$sub.is(':visible')) {
      obj.itemActivate($item, true);
    }
    return false;
  }
});