屏幕上的过渡项目
Transition item off screen on screen
我有一个 div,我有 positioned: absolute;
和 left: -250px;
。单击打开的导航栏按钮时,我希望该项目滑到页面上。我不确定我错过了什么,
.drawer .drawer-content {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: -280px;
overflow-y: scroll;
-webkit-transition: left 5s ease;
-moz-transition: left 1s linear;
-o-transition: left 1s linear;
transition: left 5s ease;
}
.open > .drawer .drawer-content {
left: 0;
webkit-transition: left 5s ease;
-moz-transition: left 1s linear;
-o-transition: left 1s linear;
transition: left 5s ease;
}
当我单击导航栏时,它会打开,但不会滑到页面上。
您还需要将 transition
属性应用于 .open > .drawer .drawer-content
代码。
.open > .drawer .drawer-content {
transition-property: left;
transition-duration: 1s;
transition-timing-function: linear;
left: 0;
}
您应该考虑优化转换代码,使其看起来更像以下内容:
transition: [transition-property] [transition-duration] [transition-timing-function] [transition-delay];
所以你的情况是:
transition: left 1s linear;
最后,别忘了使用浏览器前缀:
-webkit-transition: left 1s linear;
-moz-transition: left 1s linear;
-o-transition: left 1s linear;
transition: left 1s linear;
Css 应该看起来更像这样:
.drawer {
position: relative;
width: 100%;
height: 100%;
}
.drawer .drawer-content {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: -280px;
transition: all ease-in-out 3s;
-moz-transition: all ease-in-out 3s;
-webkit-transition: all ease-in-out 3s;
}
.open > .drawer .drawer-content {
left: 0;
}
您不需要将转换设置为 .open ... .drawer-content。它应该只在这个元素的邮件声明中。
此外,您不需要 overflow-y 用于 .drawer-content。也许 body 的 overflow-x 就足够了?:)
我认为在一个元素上使用不同的缓动选项是不合适的。
干杯 :).
我有一个 div,我有 positioned: absolute;
和 left: -250px;
。单击打开的导航栏按钮时,我希望该项目滑到页面上。我不确定我错过了什么,
.drawer .drawer-content {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: -280px;
overflow-y: scroll;
-webkit-transition: left 5s ease;
-moz-transition: left 1s linear;
-o-transition: left 1s linear;
transition: left 5s ease;
}
.open > .drawer .drawer-content {
left: 0;
webkit-transition: left 5s ease;
-moz-transition: left 1s linear;
-o-transition: left 1s linear;
transition: left 5s ease;
}
当我单击导航栏时,它会打开,但不会滑到页面上。
您还需要将 transition
属性应用于 .open > .drawer .drawer-content
代码。
.open > .drawer .drawer-content {
transition-property: left;
transition-duration: 1s;
transition-timing-function: linear;
left: 0;
}
您应该考虑优化转换代码,使其看起来更像以下内容:
transition: [transition-property] [transition-duration] [transition-timing-function] [transition-delay];
所以你的情况是:
transition: left 1s linear;
最后,别忘了使用浏览器前缀:
-webkit-transition: left 1s linear;
-moz-transition: left 1s linear;
-o-transition: left 1s linear;
transition: left 1s linear;
Css 应该看起来更像这样:
.drawer {
position: relative;
width: 100%;
height: 100%;
}
.drawer .drawer-content {
position: absolute;
top: 0;
bottom: 0;
right: 0;
left: -280px;
transition: all ease-in-out 3s;
-moz-transition: all ease-in-out 3s;
-webkit-transition: all ease-in-out 3s;
}
.open > .drawer .drawer-content {
left: 0;
}
您不需要将转换设置为 .open ... .drawer-content。它应该只在这个元素的邮件声明中。 此外,您不需要 overflow-y 用于 .drawer-content。也许 body 的 overflow-x 就足够了?:) 我认为在一个元素上使用不同的缓动选项是不合适的。 干杯 :).