100% Height Off-Canvas Foundation 5

一曲冷凌霜 提交于 2019-12-12 11:27:13

问题


I'm using Foundation and have a series of sections at height: 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.

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.


回答1:


The best option I can find so far is to add a couple of lines of 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.




回答2:


Here's the better answer: it gives both 100% height and allows the center content to scroll.

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



回答3:


put the below cords in your head.

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



回答4:


The codes attached above from my comment works something wrong. Just put the below in your application.js

   $(function() {
         var timer;

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


来源:https://stackoverflow.com/questions/20484240/100-height-off-canvas-foundation-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!