Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. General Discussion
  3. Drop down menu

Drop down menu

Scheduled Pinned Locked Moved General Discussion
29 Posts 12 Posters 5.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • arminunruhA Offline
    arminunruhA Offline
    arminunruh
    Global Moderator
    wrote on last edited by
    #2

    Hey Lucien,

    First step, edit your menu so the submenu points are indented (possible per drag and drop)

    0_1484301054519_Screen Shot 2017-01-13 at 10.49.44.png

    Second step: Use CSS in "Lay Options" -> "Custom CSS for Desktop Version":

    nav.primary .sub-menu{
        display: none;
        position: absolute;
        left: 0;
        top: 30px;
        background-color: white;
        padding: 20px;
        border: 1px solid grey;
    }
    
    nav.primary .sub-menu li{
        display: block;
    }
    
    .menu-item:hover .sub-menu{
        display: block;
    }
    

    This will not create a dropdown menu for the phone menu.

    1 Reply Last reply
    1
    • R Offline
      R Offline
      Roisinice
      wrote on last edited by
      #3

      Hi there, I just added the code to our custom CSS - worked like a charm. Only issue is that the drop down menu opens up to the left, not under the parent page it is supposed to be under.

      I've attached a screen shot showing the issue.

      I would also like to have the background transparent, so any ideas on the code would be great.

      Thanks!

      0_1487788055089_Screen Shot 2017-02-22 at 18.23.46.png

      Site is: www.icekitchen.co.uk

      1 Reply Last reply
      0
      • arminunruhA Offline
        arminunruhA Offline
        arminunruh
        Global Moderator
        wrote on last edited by arminunruh
        #4

        Hey you can try this:

        nav.primary .sub-menu{
            display: none;
            position: absolute;
            left: 0;
            top: 30px;
            background-color: rgba(255,255,255,0.9);
            padding: 20px;
            border: 1px solid grey;
        }
        
        nav.primary .sub-menu li{
            display: block;
        }
        
        .menu-item:hover .sub-menu{
            display: block;
        }
        
        li.menu-item-has-children{
            position: relative;
        }
        
        1 Reply Last reply
        0
        • R Offline
          R Offline
          Roisinice
          wrote on last edited by
          #5

          Hey thanks for this! The code works perfectly. Only slight glitch is that the hover doesn't stay too long which makes it difficult to click on the sub links - any way to fix this? Thanks!

          1 Reply Last reply
          0
          • L Offline
            L Offline
            lucienng
            wrote on last edited by
            #6

            For the longest time, I did not know I was the one who created this thread. Thanks for replying Armin! The code works, but just wanted to check, I've the same small issue as Roisinice, is there a way to let the hover stay a little longer? Thanks!!

            1 Reply Last reply
            0
            • arminunruhA Offline
              arminunruhA Offline
              arminunruh
              Global Moderator
              wrote on last edited by arminunruh
              #7

              Oh I see what you mean. Roisinice this is your code:

              nav.primary .sub-menu {
                  display: none;
                  position: absolute;
                  left: 0;
                  top: 30px;
                  background-color: white;
                  padding: 10px;
                  border: 0px solid grey;
              }
              

              top: 30px
              is a bit too much for you.
              try top: 20px

              1 Reply Last reply
              0
              • H Offline
                H Offline
                hgbnd
                wrote on last edited by
                #8

                Hey Armin, I tried to use your code but it doesn't really work on my website. The main menu category slides to the left.

                0_1493504031771_Screen Shot 2017-04-29 at 6.11.58 PM.png

                My website is hugobeniada.com

                Also, how can I add vertical space between sub menu items?

                Thanks so much for your help!

                H 1 Reply Last reply
                0
                • H hgbnd

                  Hey Armin, I tried to use your code but it doesn't really work on my website. The main menu category slides to the left.

                  0_1493504031771_Screen Shot 2017-04-29 at 6.11.58 PM.png

                  My website is hugobeniada.com

                  Also, how can I add vertical space between sub menu items?

                  Thanks so much for your help!

                  H Offline
                  H Offline
                  hgbnd
                  wrote on last edited by
                  #9

                  Hey @arminunruh, would you be able to help? That'd be highly appreciated. Thanks!

                  1 Reply Last reply
                  0
                  • mariusjopenM Offline
                    mariusjopenM Offline
                    mariusjopen
                    Global Moderator
                    wrote on last edited by
                    #10

                    Hi hgbnd,

                    sorry for the late reply!

                    Try this:

                    nav.primary .sub-menu {
                        display: none;
                        position: absolute;
                        left: 0;
                        background-color: white;
                        border: 0px solid grey;
                        padding-top: 20px;
                    }
                    

                    To explain the issue:

                    The top: 30px in the old code made the whole submenu move down.
                    Then there was a gap between the top menu and the sub menu.
                    And when you reach that gap with your cursor, the hovering stops.
                    So what I did here was to remove the gap by removing the top: 30px.

                    Then I added a padding-top: 20px which moves the box down as well. But with padding it can still be touched by the cursor.

                    Many wishes!

                    Marius

                    www.mariusjopen.world

                    H 1 Reply Last reply
                    0
                    • H Offline
                      H Offline
                      hgbnd
                      wrote on last edited by
                      #11
                      This post is deleted!
                      1 Reply Last reply
                      0
                      • mariusjopenM mariusjopen

                        Hi hgbnd,

                        sorry for the late reply!

                        Try this:

                        nav.primary .sub-menu {
                            display: none;
                            position: absolute;
                            left: 0;
                            background-color: white;
                            border: 0px solid grey;
                            padding-top: 20px;
                        }
                        

                        To explain the issue:

                        The top: 30px in the old code made the whole submenu move down.
                        Then there was a gap between the top menu and the sub menu.
                        And when you reach that gap with your cursor, the hovering stops.
                        So what I did here was to remove the gap by removing the top: 30px.

                        Then I added a padding-top: 20px which moves the box down as well. But with padding it can still be touched by the cursor.

                        Many wishes!

                        Marius

                        H Offline
                        H Offline
                        hgbnd
                        wrote on last edited by
                        #12

                        @mariusjopen Works great now, thank you! However, how do I increase the space between sub menu items?

                        1 Reply Last reply
                        0
                        • mariusjopenM Offline
                          mariusjopenM Offline
                          mariusjopen
                          Global Moderator
                          wrote on last edited by
                          #13

                          Hey Hugo,

                          This will do the job:

                          .sub-menu li {
                              margin-top: 4px;
                          }
                          

                          If you right-click on your website you can use the Inspector tool. There you can see the HTML and the CSS code. You can even display elements, when they are hidden, because the mouse does not hover on them. (Like your menu)

                          If you play around with that you can find out those things very easily.

                          All the best!

                          Marius

                          www.mariusjopen.world

                          1 Reply Last reply
                          0
                          • E Offline
                            E Offline
                            erikbunger
                            wrote on last edited by
                            #14

                            Thanks everyone for the tips with how to create a sub-menu.

                            However after putting this code into the 'custom css for desktop' it gets activated for the mobile version as well? Is there a way I can use it only for the desktop only? In the mobile version I would like all the menu points (including the submenus) to just line up under each other.

                            Many Thanks

                            1 Reply Last reply
                            0
                            • mariusjopenM Offline
                              mariusjopenM Offline
                              mariusjopen
                              Global Moderator
                              wrote on last edited by
                              #15

                              Hi @erikbunger
                              which code did you put in?

                              All the best!

                              Marius

                              www.mariusjopen.world

                              1 Reply Last reply
                              0
                              • E Offline
                                E Offline
                                erikbunger
                                wrote on last edited by
                                #16

                                Thanks for your quick response @mariusjopen. The one below. It was posted by @arminunruh in another thread in this forum:

                                /submenu/
                                nav.primary .sub-menu li{
                                display: block;
                                position: relative;
                                }
                                .sub-menu{
                                padding-top: 1px!important;
                                opacity: 0;
                                transition: opacity 200ms ease;
                                -webkit-transition: opacity 200ms ease;
                                pointer-events: none;
                                position: absolute;
                                }
                                nav.primary li:hover .sub-menu{
                                opacity: 1;
                                pointer-events: auto;
                                }
                                /**/

                                To be honest, what I really would prefer would be to have the possibility to do a second independent menu (and not a drop down) but I guess this is not possible at this stage in Laytheme?

                                Cheers
                                /Erik

                                1 Reply Last reply
                                0
                                • E Offline
                                  E Offline
                                  erikbunger
                                  wrote on last edited by
                                  #17

                                  And here is the website in question.

                                  erikbunger.com

                                  Cheers
                                  /Erik

                                  1 Reply Last reply
                                  0
                                  • mariusjopenM Offline
                                    mariusjopenM Offline
                                    mariusjopen
                                    Global Moderator
                                    wrote on last edited by
                                    #18

                                    Hi @erikbunger

                                    on mobile pages you do not have a hover. So you probably need to open the menu when you click on it.

                                    You might achieve that with jQuery I assume. It will be a bit tricky. because if you would click on the parent link to open the submenu – then the link should not get activated. Otherwise you get forwarded to the next page before the sub-menu opens.

                                    For now I do not see a simple solution for this.

                                    But we might work on that in the future.

                                    All the best!

                                    Marius

                                    www.mariusjopen.world

                                    1 Reply Last reply
                                    0
                                    • E Offline
                                      E Offline
                                      erikbunger
                                      wrote on last edited by
                                      #19

                                      Thanks @mariusjopen for your answer. The real problem for me is that there no way to do a second menu. I would prefer this to a dropdown menu. I really like laytheme but I find this to be a major disadvantage. So if I could suggest anything it would be to add that feature. It seems like there are more users waiting for this feature. I imagine it would not be too hard to add this possibility?

                                      Cheers

                                      1 Reply Last reply
                                      0
                                      • L Offline
                                        L Offline
                                        louis999
                                        wrote on last edited by
                                        #20

                                        Hi ! Nice option here. Thanks for the help. I am wondering, is there anyway to animate the dropdown so the submenu list item appears one by one ?

                                        1 Reply Last reply
                                        0
                                        • mariusjopenM Offline
                                          mariusjopenM Offline
                                          mariusjopen
                                          Global Moderator
                                          wrote on last edited by
                                          #21

                                          Dear @lucienng
                                          to understand you correctly.
                                          You do not want a dropdown-sub-menu? You want a second menu?
                                          This is possible with Laytheme. In menu-options.

                                          Sorry for asking.

                                          Best!

                                          Marius

                                          www.mariusjopen.world

                                          1 Reply Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          I also code custom websites or custom Lay features.
                                          šŸ’æ Email me here: šŸ’æ
                                          info@laytheme.com

                                          Before you post:
                                          1. When using a WordPress Cache plugin, disable it or clear your cache.
                                          2. Update Lay Theme and all Lay Theme Addons
                                          3. Disable all Plugins
                                          4. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"

                                          This often solves issues you might run into

                                          When you post:
                                          1. Post a link to where the problem is
                                          2. Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
                                          3. If the problem is difficult to explain, post screenshots / link to a video to explain it
                                          Online Users
                                          Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                                          laytheme.com
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Search