somewebmedia / hc-offcanvas-nav

JavaScript library for creating toggled off-canvas multi-level navigations, allowing endless nesting of submenu elements, supporting swipe gestures, keyboard interactions and ARIA attributes.
https://somewebmedia.github.io/hc-offcanvas-nav/
MIT License
336 stars 82 forks source link

levelTitleAsBack is ignored #51

Closed 5ulo closed 3 years ago

5ulo commented 3 years ago

I suppose the level title should be clickable and contain arrow back instedad of having another item in the navbar called All categories or Back (in default state).

document.addEventListener('DOMContentLoaded', function() {

  var Nav = new hcOffcanvasNav('#main-nav', {
    disableAt: 3000,
    customToggle: '.toggle',
    navTitle: 'All Categories',
    levelTitles: true,
    levelTitleAsBack: true
  });

});

I made a Codepen

somewebmedia commented 3 years ago

Actually levelTitleAsBack means that the "Back" button should use the previous level title as it's text, so the current behaviour is the expected one.

Each level can have its Title, so the next level can use that title as its back button, because you are going back to that level.

5ulo commented 3 years ago

I understood it correctly, but as you can see in the Codepen, the title is only above the back button.. changing levelTitleAsBack to true or false does nothing.

5ulo commented 3 years ago

sorry I see the change now.. So I didn't understood it correctly. I thought when I open eg. Magazines menu item, there should be back button called Magazines and not by the navTitle (All categories in this example)

somewebmedia commented 3 years ago

sorry I see the change now.. So I didn't understood it correctly. I thought when I open eg. Magazines menu item, there should be back button called Magazines and not by the navTitle (All categories in this example)

Well the previous level is All Categories, and the current is Magazines, so how would back button Magazines ⇦ make any sense?