想要制作Superfish垂直菜单响应

时间:2016-10-14 04:57:17

标签: menu responsive superfish

我正在使用超级鱼垂直菜单,但它不适用于响应式视图。需要修复这个以响应。

1 个答案:

答案 0 :(得分:0)

媒体查询将帮助您提高响应速度 请看codepen

中给出的this question另一个很好的例子

以下代码取自codepen,使菜单响应。

@media screen and (max-width: 768px) {
    body {
        margin: 0; } }

@media screen and (max-width: 768px) {
    header.global nav #hamburger {
        display: block; } }
header.global nav ul {
    margin: 0;
    padding: 0 25px;
    display: block; }
@media screen and (max-width: 768px) {
    header.global nav ul {
        display: none;
        margin: 7px 0;
        padding: 0; } }

@media screen and (max-width: 768px) {
    header.global nav ul li {
        width: 100%;
        background: #2d2d2d;
        border-left: none;
        border-right: none;
        border-top: 1px solid #474747;
        border-bottom: 1px solid #141414; }
    header.global nav ul li:first-child {
        border-top: none; }
    header.global nav ul li:last-child {
        border-bottom: none; } }

@media screen and (min-width: 768px) {
    header.global nav ul li:hover > a {
        position: relative; }
    header.global nav ul li:hover > a:after {
        content: "";
        position: absolute;
        left: 20px;
        top: 40px;
        border-width: 0 8px 8px;
        border-style: solid;
        border-color: rgba(0, 0, 0, 0) rgba(0, 0, 0, 0) #ef3636;
        display: block;
        width: 0;
        z-index: 999; } }
@media screen and (max-width: 768px) {
    header.global nav ul li ul {
        width: 100% !important;
    }
}
@media screen and (min-width: 768px) {
    header.global nav ul li ul li:hover a:after {
        border: none; } }