Hoverable Drop Down Menu Shopify - UPDATED [2024]

Поделиться
HTML-код
  • Опубликовано: 8 янв 2025

Комментарии • 39

  • @WillMisback
    @WillMisback  10 месяцев назад +3

    Code to go in assets/menu-dropdown.js:
    let items = document
    .querySelector(".header__inline-menu")
    .querySelectorAll("details");
    for (const item of items) {
    item.addEventListener("mouseover", () => {
    item.setAttribute("open", true);
    item.querySelector("ul").addEventListener("mouseleave", () => {
    item.removeAttribute("open");
    });
    item.addEventListener("mouseleave", () => {
    item.removeAttribute("open");
    });
    });
    }
    Linking code in sections/header.liquid:

    • @rk1546
      @rk1546 Месяц назад +2

      Hi thanks your code works, but there is an issue in the experience. Cos when my mouse is hovering from the level 1 menu, to the level 2 menu, the moment when the mouse move away from the level 1 menu, on the way towards the level 2 menu, the menu disappears, cos the mouse has hovered away from the level 1 menu, so I have to be very quick with my mouse when moving from level 1 to level 2. So overall the experience is not good for the visitor. Is there any thing that can be done for this ? eg when the mouse is hovering between the spaces of level 1 and level 2 menu, the menu remains open. Thanks

  • @DovidPerecman
    @DovidPerecman 2 месяца назад +1

    worked perfectly, and the presentation was easy to follow! Thanks so much Will!

    • @WillMisback
      @WillMisback  29 дней назад

      Thanks for the kind words David!

  • @King_OfThe_Kitchen
    @King_OfThe_Kitchen 9 месяцев назад +2

    Thanks for this help. Get ready to see this on my page when it’s realised!

  • @505.Mohamed
    @505.Mohamed 2 месяца назад +1

    Easy, straight to the point, and awesome. Thank you

  • @user-cm6tj2he4b
    @user-cm6tj2he4b 2 месяца назад +1

    Worked like a charm!

    • @WillMisback
      @WillMisback  29 дней назад

      Awesome! Thanks for letting me know!

  • @foscorsohil8940
    @foscorsohil8940 7 месяцев назад +6

    the dropdown menu disappears when you try to click on any category on the dropdown menu all page except homepage.

  • @оляАминова-г3в
    @оляАминова-г3в 2 месяца назад +1

    Thank you!

  • @CavalierSanMarco
    @CavalierSanMarco 4 месяца назад +3

    thx will, it worked with a single drop-down menu, yet it did not work on a double-nested drop-down menu. On a double-nested drop down the menu disappears when you try to bring your mouse right after double-nested items. Any chance to help with this?

  • @millieheine1115
    @millieheine1115 9 месяцев назад +1

    Thank so much for this!! Used your old tutorial on old Dawn website and wanted to update to new Dawn theme so needed this for it! Can you also show how to make them clickable like you did with old Dawn them. Thanks so much!

    • @WillMisback
      @WillMisback  9 месяцев назад

      Will post a part 2 to this tomorrow with that info!

    • @dv2517tx
      @dv2517tx 8 месяцев назад

      @@WillMisback Hi, love this, thank you so much! Can you please guide me to the link for Part 2 of this video (clickable title menu). I can't seem to find it. I only see the old video.

    • @TopGamer-hn4or
      @TopGamer-hn4or 2 месяца назад +1

      @@WillMisbackhey, when should we expect part 2? 😇

    • @JanNovák-l6u
      @JanNovák-l6u 2 месяца назад

      @@TopGamer-hn4or Yeah part 2 would be great

  • @christianvarenhorst107
    @christianvarenhorst107 3 месяца назад +1

    I am having an issue with this code, I have added sub menus to my menus, and the hover works for the first set of menus but once I navigate past the first submenu, the whole menu closes... can you please help?

  • @davilamb
    @davilamb 9 месяцев назад +3

    hi is it possible to change the code to work with mega menu? Thank you!

  • @allgoldcoins5800
    @allgoldcoins5800 5 месяцев назад

    Works perfectly thx

  • @JanNovák-l6u
    @JanNovák-l6u 2 месяца назад

    When should part 2 with the clickable parent be available?

  • @TopGamer-hn4or
    @TopGamer-hn4or 2 месяца назад

    When is part 2 coming? I need it to be clickable❤

  • @Vasu-q2j
    @Vasu-q2j 5 месяцев назад

    @WillMisback this fix works perfectly for studio template but for trade the dropdown gets closed as soon as we move the cursor to the items in the dropdown. What would your suggestion be to deal with this problem?

    • @WillMisback
      @WillMisback  4 месяца назад

      Hey Vasu that's probably an issue with the spacing of those elements. This will only work if your cursor is hovering over certain elements. Fixes would be changing padding/margins or expanding the kinds of elements the hover works on.

  • @KyonProfileZ
    @KyonProfileZ 8 месяцев назад

    Great video! I'm using it to show subcollections of my store, but i have a question, since you can hover the mouse on the menu to make the dropdown, is there any way to make it that if you click the menu you go to the collection? The way it's working right now is when i click it it will just close the dropdown menu.

    • @RenédeHaas-s4z
      @RenédeHaas-s4z 7 месяцев назад

      I have the same question

    • @WillMisback
      @WillMisback  4 месяца назад +1

      Going to record another video on this as I have just seen that others are having this issue

    • @RenédeHaas-s4z
      @RenédeHaas-s4z 4 месяца назад

      @@WillMisback that would be great

  • @PalchaHandicraft
    @PalchaHandicraft 5 месяцев назад +1

    hey love your video. Could you please show how to make header clickable in Sense theme. Thanks so much!

    • @NatassiaMarie
      @NatassiaMarie 5 месяцев назад

      Did you ever find a solution to this? I'm using Taste and when I create a dropdown menu the main menu items are no longer clickable

    • @WillMisback
      @WillMisback  4 месяца назад

      Good catch! I will post an optional update video to make these items clickable, thanks for letting me know

  • @Bizarr0
    @Bizarr0 8 месяцев назад

    Thanks for your help! Im having problem when hovering on menu and scrolling down to click on menu drop down category it dissapears befire i can reach the category Can u help with this?

    • @WillMisback
      @WillMisback  8 месяцев назад +1

      The top of the menu might not be right underneath the dropdown. You may have luck changing its 'top' css property or the 'margin-top' property!

    • @Bizarr0
      @Bizarr0 8 месяцев назад

      @@WillMisback thank you. Is this done with surface settings or do I have to go through liquid and edit code?

    • @Burak-ny8ym
      @Burak-ny8ym 6 месяцев назад +1

      @@Bizarr0 hello, i have been having the same problem and i cant find any solution did you find any solutions by any chance?