gpt4 book ai didi

html - 屏幕上的过渡元素

转载 作者:太空宇宙 更新时间:2023-11-04 11:05:27 24 4
gpt4 key购买 nike

我有一个 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;

关于html - 屏幕上的过渡元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34007924/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com