【发布时间】:2016-03-22 10:16:55
【问题描述】:
我有一个右侧边栏。我正在使用字体真棒左角图标来显示/隐藏边栏。单击切换按钮侧栏将内容与按钮一起向左推,然后按钮(字体真棒左角)旋转 180 度变成(字体真棒右角)作为动画。到这里为止一切正常。但是当我滚动页面时,切换按钮也会垂直滚动。
在这里,我不希望切换按钮每次都垂直滚动。 我尝试了位置:固定在 css 中,垂直滚动停止但侧边栏没有水平按下切换按钮。侧栏与切换按钮重叠(仅在 Firefox 中)。
在 chrome 中它工作正常。垂直滚动停止并且侧边栏将内容推到左侧,但这在 Firefox 中没有发生。
css:
.container {
position: relative;
height: 100%;
width: 100%;
right: 0;
-webkit-transition: right 1s ease-in-out;
-moz-transition: right 1s ease-in-out;
-ms-transition: right 1s ease-in-out;
-o-transition: right 1s ease-in-out;
transition: right 1s ease-in-out;
}
.container.open-sidebar {
right: 240px;
}
#sidebar {
position: absolute;
right: -240px;
background-color: rgba(0, 0, 0, 0.3);
width: 240px;
height: 100%;
}
.content {
width: 100%;
height: 100%;
padding: 10px;
position: relative;
padding-left: 50px;
}
.content #sidebar-toggle {
background: transparent;
color: white;
opacity: 0.5;
border-radius: 1px;
display: block;
position: relative;
padding: 30px 7px;
float: right;
}
.padtop {
line-height: 600px;
color: white;
opacity: 0.5;
position: fixed;
}
.rotate {
-moz-transition: all 0.5s linear;
-webkit-transition: all 0.5s linear;
transition: all 0.5s linear;
}
.rotate.side {
-moz-transform:rotate(180deg);
-webkit-transform:rotate(180deg);
transform:rotate(180deg);
}
html:
<div class="container">
<div class="col-sm-1">
<a href="#" data-toggle=".container" id="sidebar-toggle">
<i class="fa fa-angle-double-left fa-5x padtop rotate"></i></a>
</div>
</div>
这是我的 o/p: o/p in Firefox o/p in Chrome
【问题讨论】:
-
你能用JsFiddle之类的方式重现问题吗?
-
jsfiddle.net/57hdjprL 这是 JSFiddle @gaynorvader ..你能在 qtn 中找到图像吗...我有类似的东西...但我希望那个按钮被按下当侧边栏出现在屏幕上时左侧..
标签: javascript jquery html css toggle