Avada Theme - Submenu customization

2019-08-17 06:26发布

I just started using the Avada Theme in my wordpress site. I need to customize the menu on the left hand side. The items in the submenu should be shown below the parent item, not on next to it. I started by using the side-navigation css styles, but I can't get the child items to work.

.side-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid #ededed;
  margin-bottom: 20px;
}
.side-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.side-nav li {
  margin: 0;
  padding: 0;
}
.side-nav li a {
  border-bottom: 1px solid #ededed;
  display: block;
  height: auto;
  font-weight: normal;
  font: 14px/39px 'MuseoSlab500Regular', arial, helvetica, sans-serif;
  color: #333333;
}
.side-nav li a {
  line-height: 1.69em;
  padding: 8px 0;
}
.side-nav li a:hover {
  background: none;
}
.side-nav li.current_page_item > a {
  background: none;
  color: #a0ce4e;
}
.side-nav li.current_page_item li a {
  color: #333333;
  border-bottom: 1px solid #ededed;
}
.side-nav .children {
  display: none;
  margin-left: 15px;
}
.side-nav .arrow {
  display: inline;
  margin-left: 0;
}
.side-nav .arrow:after {
  position: absolute;
  font-size: 14px;
  font-family: IcoMoon;
}
.side-nav-left .side-nav {
  border-right: 1px solid #ededed;
}
.side-nav-left .side-nav li.current_page_item > a {
  border-right: 3px solid #a0ce4e;
}
.side-nav-left .side-nav .arrow {
  margin-left: 10px;
}
.side-nav-left .side-nav .arrow:after {
  content: '\f105';
}
.side-nav-right .side-nav {
  border-left: 1px solid #ededed;
}
.side-nav-right .side-nav li.current_page_item > a {
  padding-left: 23px;
  border-left: 3px solid #a0ce4e;
}
.side-nav-right .side-nav li a {
  padding-left: 25px;
}
.side-nav-right .side-nav .arrow {
  margin-right: 10px;
}
.side-nav-right .side-nav .arrow:after {
  content: '\f104';
}
.side-nav-right .side-nav .children {
  margin-left: 40px;
}
.side-nav-right .side-nav .children a {
  padding-left: 0;
}

For better understanding here is a screenshot of what I try to build. enter image description here The Image on the left shows the current style of the menu / submenu. The image on the right is showing the side-navigation template which comes with Avada. Out of the Box it's not possible to use the side-navigation style in the main menu. I already posted a question in the Theme-Fursion forum, but they were not able to help me. Maybe you can give me a hint. Thank you

1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-08-17 07:25

To achieve this effect you would have to change the positioning of the submenu list from absolute to relative, and adjust it a bit e.g. in this way:

body.side-header-left #side-header #nav > ul > li > ul.sub-menu {                
    position: relative;
    right: auto;
    left: auto;
    top: auto;
    visibility: visible;
    opacity: 1;
    width: 100%;
    height: 0;
    overflow:hidden;
}
body.side-header-left #side-header #nav > ul > li:hover > ul.sub-menu,
body.side-header-left #side-header #nav > ul > li.current_page_item > ul.sub-menu {
    height: auto;
}
查看更多
登录 后发表回答