Avada主题 - 子菜单定制

时间:2015-03-26 11:15:29

标签: php html css wordpress themes

我刚开始在wordpress网站上使用Avada Theme。我需要在左侧自定义菜单。子菜单中的项目应显示在父项目下方,而不是旁边的项目。我开始使用侧导航css样式,但我无法让子项工作。

.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;
}

为了更好地理解,这里是我尝试构建的截图。 enter image description here 左侧的图像显示菜单/子菜单的当前样式。右侧的图像显示了Avada附带的侧面导航模板。开箱即用,无法在主菜单中使用侧面导航样式。我已经在Theme-Fursion论坛上发了一个问题,但他们无法帮助我。也许你可以给我一个提示。 谢谢

1 个答案:

答案 0 :(得分:1)

要实现此效果,您必须将子菜单列表的定位从absolute更改为relative,并稍微调整一下,例如这样:

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;
}