汉堡菜单的IE9 CSS问题



我正在使用Pure Drawer脚本为即将到来的网站生成滑块抽屉导航方案(http://advanced1772.inmotionhosting.com/~authenticstorite/)。效果很好,但客户希望它能在IE9中运行(是的,真的……),在IE9上,汉堡菜单看起来就像刚刚经历了一场拆迁德比。我认为这可能是因为它使用了:before和:after伪元素来生成菜单。那么,有没有一种替代方法可以在IE9上实现这一点呢。抽屉本身就很好用。问题出在汉堡图标上:

HTML

<div class="pure-container" data-effect="pure-effect-slide">
<input type="checkbox" id="pure-toggle-right" class="pure-toggle" data-toggle="right">
<label class="pure-toggle-label" for="pure-toggle-right" data-toggle-label="right">
<span class="pure-toggle-icon"></span> </label>
<div class="pure-drawer" data-position="right">
<nav id="site-navigation" class="main-navigation" role="navigation">
<div class="menu-nav-container">
<ul id="primary-menu" class="menu">
<li id="menu-item-16" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-16"><a href="http://advanced1772.inmotionhosting.com/~authenticstoryte/sample-page/">Sample Page</a></li>
<li id="menu-item-17" class="menu-item menu-item-type-post_type menu-item-object-post menu-item-17"><a href="http://advanced1772.inmotionhosting.com/~authenticstoryte/2016/04/25/hello-world/">Hello world!</a></li>
</ul>
</div>
</nav>
</div>
<div class="pure-pusher-container">
<div class="pure-pusher">

CSS

.pure-toggle-label { border: none!important; top: 4px!important; }
.pure-toggle-label .pure-toggle-icon {
    transform: translate3d(-50%, -4px, 0);
    -webkit-transform: translate3d(-50%, -4px, 0);
}
.pure-toggle-label .pure-toggle-icon, .pure-toggle-label .pure-toggle-icon::before, .pure-toggle-label .pure-toggle-icon::after {
    position: absolute;
    top: 50%;
    left: 50%;
    height: 4px;
    width: 35px;
    cursor: pointer;
    background: #5d809d;
    display: block;
    content: '';
    transition: all 500ms ease-in-out;
}
*, *::before, *::after {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}
*, *::before, *::after {
    box-sizing: inherit;
}

在IE9仿真中用您的页面进行了测试,我添加了以下内容:

.pure-toggle-label .pure-toggle-icon::after {
    -ms-transform: translate(-50%, 10px);
}
.pure-toggle-label .pure-toggle-icon::before {
    -ms-transform: translate(-50%, -14px);
}

这将使translate3d单独存在,尽管看起来您实际上只需要2d。

有关过渡效果,请参阅:IE9是否支持过渡CSS3效果?

相关内容

  • 没有找到相关文章

最新更新