简体   繁体   English

100%高度露天基金会5

[英]100% Height Off-Canvas Foundation 5

I'm using Foundation and have a series of sections at height: 100%. 我正在使用Foundation并且在高度上有一系列部分:100%。

I'm using the off-canvas menu but it's only matching the height of the first section / the viewport. 我正在使用非画布菜单,但它只匹配第一部分/视口的高度。 So once I scroll, the off-canvas menu is no longer aligned to the height of the viewport. 因此,一旦我滚动,非画布菜单就不再与视口的高度对齐。

It's a similar issue to Foundation 5 off-canvas full height of device . 这与基础5画布全高度设备类似。

I'm ending up with this: 我结束了这个:

All good 都好

After scrolling down to next section 滚动到下一部分后

I think it can be solved by to adding position: fixed to left-off-canvas-menu, but that's not working. 我认为可以通过添加位置来解决:固定到左侧画布菜单,但这不起作用。

It's driving me mad. 这让我很生气。

The best option I can find so far is to add a couple of lines of css: 到目前为止我能找到的最佳选择是添加几行css:

        .off-canvas-wrap, .inner-wrap {
            min-height: 100%;
        }

        .off-canvas-wrap{  
        height: 100%;
        overflow-y: auto;
        }

Although this fixes it for the most part, scrolling on a touch device is not 100% perfect, every now and then you do get a weird scenario where the bottom of the browser drags upwards. 虽然这在很大程度上解决了这个问题,但是在触控设备上滚动并不是100%完美,不时会出现一个奇怪的情况,即浏览器的底部向上拖动。

Here's the better answer: it gives both 100% height and allows the center content to scroll. 这是更好的答案:它提供100%的高度并允许中心内容滚动。

.off-canvas-wrap, .inner-wrap, .main-section { height:100%; }
.main-section { overflow-y: auto; }

put the below cords in your head. 将以下绳索放在头上。

  .off-canvas-wrap,.inner-wrap,.main-section{
      height:100%;   
  }

The codes attached above from my comment works something wrong. 我评论上面附带的代码有点错误。 Just put the below in your application.js 只需将以下内容放入application.js即可

   $(function() {
         var timer;

         $(window).resize(function() {
            clearTimeout(timer);
            timer = setTimeout(function() {
               $('.inner-wrap').css("min-height", $(window).height() + "px" );
                }, 40);
          }).resize();
     });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM