contao-themes-net / nature-theme-bundle

nature theme bundle for contao cms
Other
7 stars 2 forks source link

Keep your Megamenue opened at first Klick on it #72

Closed witzker closed 1 year ago

witzker commented 1 year ago

Description

**sorry, not clever enough!**

Hi, I hope that is the right place for my request! I'm just switching over from Joomla and I think that your template will meet my demands. As I'm total new with this stuff, I would like to ask a question about your Megamenue I noticed when hoovering over the menu entry module after clicking Megamenue the Megamenue is displayed until you leave the menu entry - Right? What I want to achieve is: When adding new Main menu entry and the visitor of my homepage klicks on it the Megamenue shall be opened AND stays open so even if the visitor when visiting some sub entry of the Megamenue is able to see the still opened Megamenu sub entries and easily can switch to another subentry if he does not find the desired information on the first click. Without going back to open the Megamenue again

I hope You can understand my request. This menu should stay opened on first click image Hope for Instructions Many THX

MDevster commented 1 year ago

We'll take a look at it, Philipp will get back to you here on Monday.

witzker commented 1 year ago

Great news MDevster many THX for taking care

seibtph commented 1 year ago

Maybe this jquery code helps you:

<script>
jQuery(document).ready(function($) {
  $('.megamenu .level_1 > .submenu > a').click(function(e) {
    if($(this).next().css('display') === 'flex') {
      $(this).next().css('display', 'none');
    } else {
      $('.navbar-dropdown.level_2').css('display', 'none');
      $(this).next().css('display', 'flex');
    }
    e.preventDefault();
  });

  $('body').click(function(e) {
    if($(e.target).closest('.megamenu').length === 0) {
      $('.navbar-dropdown.level_2').css('display', 'none');
    }
  });
});
</script>

When the visitor click a menu entry the megamenu shall be opened.

Add folowing scss to prevent the mouse hover:

.megamenu .navbar-item:hover .navbar-dropdown.level_2 {
    display: none;
}