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;
  }
});

Register

You will be emailed a link to set your password.

Login

Lost password?