是否有一种与Ionic2一起使用`exposed-aside-when`的解决方案?

时间:2017-02-06 00:26:44

标签: angular ionic2

使用Ionic 2,当屏幕大于768px时,是否有办法随时显示侧面菜单?

在离子1中有“暴露 - 搁置时”,而不是在离子2中。

注意:我找到了解决方案,但没有使用最新版本。 https://forum.ionicframework.com/t/expose-aside-when-in-ionic-2/42949

1 个答案:

答案 0 :(得分:0)

我不确定这是一个很好的解决方案,但至少我可以一直看到侧边菜单。

@media (min-width: 767px) {
  ion-menu {  /* always show menu */
    display: block;
  }

  .menu-inner {  /* always show menu */
    transform: translateX(0px) !important;
  }

  ion-nav.menu-content { /* always show menu content */
    cursor: pointer;
    -ms-touch-action: manipulation;
    touch-action: manipulation;
    transform: translateX(304px !important);
  }

  .ion-page { /* recalculate page contents width deducted by menu width */
    width: calc(100% - 304px);
  }

  button[menutoggle] { /* hide all non-working menu buttons */
    display: none;
  }
}

此解决方案的问题在于我无法再显示和隐藏菜单。它一直在那里。

如果我真的想显示/隐藏菜单,我必须为它添加自定义代码。