gpt4 book ai didi

CSS Transitions 仅在等待后才起作用

转载 作者:行者123 更新时间:2023-11-28 09:38:11 24 4
gpt4 key购买 nike

我正在构建一个响应式 Angular 网站 ( can be viewed here ) 并构建了一个指令来处理我网站的 header 。但是,CSS 转换有一些奇怪的行为。

我将首先回顾一下应该发生的事情:

  • 当窗口大小调整到 600 像素以下时,“主页”和“元素”会滑出。
  • 当您点击绿色方 block 时,橙色面板会向下滑动,蓝色框会以更紧凑的形式重新排列。
  • 当您再次点击绿色方 block 时,橙色面板会向上滑动,蓝色框会返回到它们之前的位置。

最后,所有元素都位于所需位置,但有时动画有效,有时则无效。

  • 点击展开橙色面板从不显示动画
  • 永远不会显示橙色面板展开时移动蓝色框的动画。
  • 如果用户在压缩之前等待,压缩橙色面板只会显示动画。展开面板,然后快速点击绿色方 block 会导致动画失败。
  • 调整大小时动画的成功显示似乎是零星的。

这可能与在 Angular 指令中应用范围更新的方式有关,但我认为这可能与 CSS 过渡有关,因为它们仍处于试验阶段。以下是我的这个标题的 CSS:

#headerDiv {
position: absolute;
top: 0px;
left: 0px;
right: 0px;
background-color: orange;
z-index: 100;
overflow: hidden;
-webkit-transition: all 600ms ease;
-moz-transition: all 600ms ease;
-ms-transition: all 600ms ease;
transition: all 600ms ease;
}
.headerUnexpanded {
height: 50px;
}
.headerExpanded {
height: 150px;
}
#headerCenter {
position: absolute;
top: 0px;
bottom: 0px;
left: 50%;
right: 50%;
overflow: visible;
}

#headerIcon {
margin: auto;
position: absolute;
left: 0;
bottom: 5px;
right: 0;
width: 40px;
height: 40px;
background-color: green;
}

#headerHome {
margin: auto;
position: absolute;
width: 100px;
height: 40px;
background-color: blue;
-webkit-transition: all 600ms ease;
-moz-transition: all 600ms ease;
-ms-transition: all 600ms ease;
transition: all 600ms ease;
}
#headerHome.here {
top: 5px;
right: 175px;
}
#headerHome.gone {
top: 5px;
right: 300px;
}
#headerHome.expand {
top: 55px;
right: 50px;
}

#headerProjects {
margin: auto;
position: absolute;
width: 100px;
height: 40px;
background-color: blue;
-webkit-transition: all 600ms ease;
-moz-transition: all 600ms ease;
-ms-transition: all 600ms ease;
transition: all 600ms ease;
}
#headerProjects.here {
top: 5px;
left: 175px;
}
#headerProjects.gone {
top: 5px;
left: 300px;
}
#headerProjects.expand {
top: 55px;
left: 50px;
}

#headerResume {
position: absolute;
top: 5px;
bottom: 0;
right: 50px;
width: 100px;
height: 40px;
background-color: blue;
}

#headerContact {
position: absolute;
top: 5px;
bottom: 0;
left: 50px;
width: 100px;
height: 40px;
background-color: blue;
}

谢谢

最佳答案

对于您的第一个问题,您能否将导航器的最小宽度设置为 700 像素或您想要的值。

对于单击绿色按钮时所有按钮移动的问题,我应该做的是在标题栏下方创建一个 divm。因此,当您单击绿色按钮时,该栏会向下滑动。

希望本文能对您有所帮助。

关于CSS Transitions 仅在等待后才起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25468326/

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