【问题标题】:Mobile menu doesn't scroll手机菜单不滚动
【发布时间】:2015-04-27 16:26:37
【问题描述】:

移动页面就像我想要的那样工作,但问题是当我打开网站导航时,主要内容正在向下滑动并且导航是静态的。我无法滚动导航.. 无论如何我只能滚动导航?问题所在的站点是www.budivelik.hr 知道吗?

  body > .main-nav {
    position: fixed;
    top: 0;
    left: -210px;
    bottom: 0;
    height: 100%;
    padding-top: 80px;
    margin-top: 0;
    width: 210px;
    z-index: 101;
    background: #333333;
    overflow: hidden;
    -webkit-box-shadow: inset 0 0 30px rgba(0,0,0,0.4);
    box-shadow:         inset 0 0 30px rgba(0,0,0,0.4);
    z-index: 150;
    -webkit-user-select:  none;
    -moz-user-select:     none;
    -ms-user-select:      none;
    -o-user-select:       none;
    user-select:          none;
  }

  .main-nav.active-menu {
    left: 0;
  }

  .main-header .nav-bar {
    display: block;
  }

  body.menu-effect .boxed-view {
  -webkit-transition: all 0.4s ease;
   -webkit-transform: translate(200px,0);
   z-index: 100;
   position: relative;
  }

  body > .main-nav > ul,
  body > .main-nav > ul > li {
    float: none;
  }

  body > .main-nav > ul > li > a {
    display: block;
    background: rgba(0,0,0,0.3);
    padding: 20px 11px 18px;
    margin-left: 0;
    margin-right: 0;
    border-bottom-color: rgba(255,255,255,0.1);
  }

  body .mobile-menu-button {
    display: block;
    width: 62px;
    height: 62px;
    margin: auto;
    padding:  1px 5px;

    font-size: 24px;
    position: absolute;
    right: 76px;
    top: 0;
    bottom: 0px;
    margin: auto;
    text-align: center;
    line-height: 62px;
    background: url("../images/icons/menu-icon.png") no-repeat 0 0 transparent;
  }

  body .woocommerce-page .mobile-menu-button{
    background: url("../images/icons/white-menu-icon.png") no-repeat 0 0 transparent;
    background-size: cover;
    
    right: 132px;
  }

  .mobile-menu-button:hover {
    text-decoration: none;
  }

  .product .summary{
      padding: 0 20px;
  }

  .main-header .socials{
    margin: 12px 0 0;
  }

  .social-links > li a {
      max-height: 48px;
      width: 36px;
  }

  .main-slider .sneakers{
    left: 20%;
  }

  .recommend-block{
    margin-top: 40px;
  }

  .gallery-slider .quarter-size .gallery-photo-desc > div .zoom-image{
      transform: scale(0.8) translate(0px, -70%);
  }


}

@media screen and (max-width: 992px){
    .big-footer .sportify-wrap{
        display: none;
    }

    .big-footer .footer-block{
        margin-top: 20px;
    }

    .contact-form label{
        margin-top: 20px;
    }

    .error-box .sneakers-block{
        padding-top: 60px;
    }

    .new-arrivals > .row > div{
        width: 25%;
    }

    .new-arrivals > .row > div:nth-child(5){
        border-top: medium none;
    }

    .new-arrivals > .row > div:nth-child(5n+1){
        border-left: medium none;
    }

    .new-arrivals > .row > div:nth-child(4n+1){
       border-left: 1px solid #e5e5e5;
    }

    .team-item header a{
      width: 50%;
    }

    .team-list > li{
      width: 50%;
    }

    .shop-slider .round-offer{
        left: 50%;
    }

    .shop-slider .round-offer{
        width: 286px;
        height: 286px;
        left: 40%;
    }

    .shop-slider .round-offer:before{
        width: 334px;
        height: 334px;
    }

    .member-box figure img{
      width: 100%;
    }

    .commentlist > li .children{
        margin-left: 20px;
    }

    .member-box .content{
      min-height: 100px !important;
    }
}


@media screen and (max-width: 768px){
    .main-header .ad{
        margin-top: 18px;
    }

    .main-header .socials{
        display: none;
    }

    .big-footer .footer-block{
        padding-bottom: 60px;
    }

    .big-footer .contact-block{
        position: relative;
        width: auto;
        bottom: auto;
        left: auto;
    }

    .big-footer .contact-block textarea{
        margin-top: 30px;
    }

    .big-footer .contact-block .form-submit{
        text-align: center;
    }

    .filter-box ul li,
    .filter-box > div{
        width: 100%;
    }

    .filter-box ul li a{
        font-size: 18px;
        padding: 10px; 
    }

    .timetable thead tr > th:nth-child(1),
    .timetable tbody tr > th{
        display: none;
    }

    .new-arrivals > .row > div{
        width: 50%;
    }

    
    .new-arrivals > .row > div:nth-child(3), 
    .new-arrivals > .row > div:nth-child(4), 
    .new-arrivals > .row > div:nth-child(5){
        border-top: medium none;
    }

    .new-arrivals > .row > div:nth-child(5n+1){
        border-left: medium none;
    }

    .new-arrivals > .row > div:nth-child(2n+1){
       border-left: 1px solid #e5e5e5;
    }

    .about-box header .header-block .entry-header{
      position: static;
      top: 0;
      left: 0;
    }

    .blog-box figure img{
      width: 100%;
    }

    body .woocommerce-page .mobile-menu-button{
      width: 52px;
      height: 52px;
      right: 160px;
    }

    .news-block .news-list li .row > div:hover:before{
      height: 100%;
    }

    .commentlist > li .children{
      margin-left: 10px;
    }

    .blog-box .blog-items > div{
      width: 100%;
    }


}

@media screen and (max-width: 724px){
    .main-header .ad{
        margin-top: 15px;
    }

      body .mobile-menu-button {
        right: 22px;
      }

      .team-list > li{
        width: 100%;
      }

      .tp-bullets {
          margin-left: 5% !important;
      }

}

@media screen and (max-width: 670px){
    .woo-container .shopping-cart-wrap .coupon-code-block .coupon-field{
        width: 50%;
    }

    .woo-container .shopping-cart-wrap .coupon-code-block .button{
        width: 50%;
    }

    .update-cart{
      float: none;
      text-align: right;
      margin-bottom: 20px;
    }

}

@media screen and (max-width: 640px){
    .nav-bar .identity{
        text-align: center;
    }

    .nav-bar .identity img{
        max-height: 40px;
        max-width: 120px;

    }

    body .woocommerce-page .mobile-menu-button{
      right: 130px;
      width: 42px;
      height: 42px;
      background-position: 0 -2px;
    }

    body .woocommerce-page .search-block{
      display: none;
    }

    body .woocommerce-page header .col-xs-4{
      width: 100%;
    }

    body .woocommerce-page > header .cart-all{
      margin-left: 15px;
    }

    body .woocommerce-page > header .cart-all i,
    body .woocommerce-page > header .cart-all .amount{
      width: 50%;
    }

    body .woocommerce-page > header .col-xs-3{
      width: 100%;
    }

    .show-content > header .col-xs-4{
      width: 100%;
    }

    .show-content > header .ad{
      display: none;
    }

    .page-slider-block ul li .col-xs-6{
      width: 100%;
    }

    .page-slider-box .slider-controls{
      bottom: 30%;
    }

    .checkout_coupon input[type="text"]{
      min-width: 120px !important;
      width: auto !important;
    }


}

@media screen and (max-width: 480px){
    .sneakers-block{
        display: none;
    }

    body .woocommerce-page .mobile-menu-button{
      right: 10px;
    }

    .team-item header a{
      width: 100%;
      text-align: center;
      padding: 10px 0 4px 10px;
    }

    .team-item header a br{
      display: none;
    }

    .classes-box .classes{
      width: 100%;
      left: 0;
    }

    .classes-box nav .toggle-content .entry-header{
      padding-top: 20px;
      margin-top: 12px;
    }

    .classes-box nav .toggle-content{
      position: relative;
      left: 0;
      width: 100%;
    }

    .classes-box .classes-content-block .read-more{
      position: relative;
      bottom: 0;
      right: 0;
      font-size: 20px;
      line-height: 18px;
      margin-top: 20px;
      padding: 12px 50px 8px 0px
    }

    .box-header .entry-header{

      font-size: 22px;
      line-height: 28px;
    }

    body .mobile-menu-button{
      right: 10px;
    }
}

这是我用于移动版网站的 CSS..

【问题讨论】:

  • 如果将body > .main-nav{overflow:hidden} 更改为body > .main-nav{overflow:auto} 会发生什么??
  • 还是同样的问题,我试过自动和滚动,什么都没有..
  • 确保您的光标位于.main-nav 类中以使其工作。
  • 你是什么意思?我没听懂你..
  • 抱歉,我已经在桌面浏览器响应视图中测试过了。

标签: html css wordpress


【解决方案1】:

滚动导航只使用下面的css代码

@media (max-width: 992px){

    body > .main-nav {
        overflow: scroll;
    }

}

【讨论】:

  • 你在哪里测试你的移动滚动?
  • 在移动设备上.. iphone 6, and htc one m8
  • 对我来说,它可以在 Nexus 5 上使用 :scroll 和 :auto
  • 在 chrome 或其他移动浏览器中?因为我在 chrome 中测试了它
  • 使用最新的 chrome,尝试检查它是否发生冲突,因为在移动视图方面您有两个
猜你喜欢
  • 2015-02-02
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-02-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多