admin管理员组文章数量:1208155
why does #object
gets rotated when scrolled in sticky? if that's the intended behavior, then why does it flash back? the flashes aren't even consistent. it flashes back immediately when I hold the scrollbar, drag and release. but when mouse wheel is used, it doesn't feel like flashing, but sometimes do when you click or interact. seems like a bug to me. doesn't happen on chrome.
#container {
overflow: scroll;
height: 200px;
}
#space {
position: sticky;
top: 0;
perspective: 300px;
}
#object {
transform: rotateX(45deg)
}
#content {
height: 400%;
}
/*
visual styles
*/
#container {
background-color: #222;
display: flex;
flex-direction: row-reverse;
padding: 30px;
}
#object {
background-color: #888;
text-align: center;
border-radius: 16px;
width: 140px;
height: 140px;
}
#content {
color: #eee;
padding: 30px;
}
<div id="container">
<div id="space">
<div id="object">solid</div>
</div>
<div id="content">
hjkl<br>hjkl<br>hjkl<br>hjkl<br>hjkl<br>hjkl<br>
hjkl<br>hjkl<br>hjkl<br>hjkl<br>hjkl<br>hjkl<br>
</div>
</div>
why does #object
gets rotated when scrolled in sticky? if that's the intended behavior, then why does it flash back? the flashes aren't even consistent. it flashes back immediately when I hold the scrollbar, drag and release. but when mouse wheel is used, it doesn't feel like flashing, but sometimes do when you click or interact. seems like a bug to me. doesn't happen on chrome.
#container {
overflow: scroll;
height: 200px;
}
#space {
position: sticky;
top: 0;
perspective: 300px;
}
#object {
transform: rotateX(45deg)
}
#content {
height: 400%;
}
/*
visual styles
*/
#container {
background-color: #222;
display: flex;
flex-direction: row-reverse;
padding: 30px;
}
#object {
background-color: #888;
text-align: center;
border-radius: 16px;
width: 140px;
height: 140px;
}
#content {
color: #eee;
padding: 30px;
}
<div id="container">
<div id="space">
<div id="object">solid</div>
</div>
<div id="content">
hjkl<br>hjkl<br>hjkl<br>hjkl<br>hjkl<br>hjkl<br>
hjkl<br>hjkl<br>hjkl<br>hjkl<br>hjkl<br>hjkl<br>
</div>
</div>
Share
Improve this question
edited Jan 20 at 17:48
Vagif VALIYEV
asked Jan 20 at 17:29
Vagif VALIYEVVagif VALIYEV
3232 silver badges11 bronze badges
3
|
1 Answer
Reset to default 0I've found a very strange workaround. when I apply overflow: scroll
and perspective
to the same element, the transformations for the sticky element works properly. but now it's not exactly just X rotated :/
#container {
overflow: scroll;
height: 200px;
perspective: 300px;
}
#object {
position: sticky;
top: 0;
transform: rotateX(45deg);
}
#content {
height: 400%;
}
/*
visual styles
*/
#container {
background-color: #222;
display: flex;
flex-direction: row-reverse;
padding: 30px;
}
#object {
background-color: #888;
text-align: center;
border-radius: 16px;
width: 140px;
height: 140px;
}
#content {
color: #eee;
padding: 30px;
}
<div id="container">
<div id="object">solid</div>
<div id="content">
hjkl<br>hjkl<br>hjkl<br>hjkl<br>hjkl<br>hjkl<br>
hjkl<br>hjkl<br>hjkl<br>hjkl<br>hjkl<br>hjkl<br>
</div>
</div>
本文标签: cssweird transformations when scrolled with perspectiveposition sticky on firefoxStack Overflow
版权声明:本文标题:css - weird transformations when scrolled with perspective+position sticky on firefox - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738677185a2106334.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
sticky+perspective
. since it was behaving different for you, I wonder if this approach fixes it for you too? – Vagif VALIYEV Commented Jan 22 at 21:46