I am working with a
<div class="scrollable">
that has the CSS property overflow: scroll;
. Additionally, I have another <div class="line1"></div>
which should not trigger any scrolling on the <div class="scrollable">
(as I plan to animate the translation of <div class="line1"></div>
later). To achieve this, I created an outer div with overflow:hidden
.
However, when I apply the translation animation (seen in the blue box), it creates a white area on the left side which is not the desired outcome (I want it to behave like the right side).
Any suggestions on how to resolve or modify this issue would be greatly appreciated.
Thank you in advance.
.scrollable {
overflow: scroll;
width: 200px;
height: 300px;
border: 2px solid red;
}
.inner-container {
width: 300px;
height: 150px;
background-color: gray;
}
.no-scroll {
width: 300px;
overflow: hidden;
}
.line1 {
height: 50px;
margin-left: -50px;
width: 500px;
background-color: blue;
animation: wave 4s 0.1s infinite linear;
}
@keyframes wave {
0% {
-webkit-transform: rotateZ(0deg) translate3d(0, 50%, 0) rotateZ(0deg);
-moz-transform: rotateZ(0deg) translate3d(0, 50%, 0) rotateZ(0deg);
transform: rotateZ(0deg) translate3d(0, 50%, 0) rotateZ(0deg);
}
100% {
-webkit-transform: rotateZ(360deg) translate3d(0, 50%, 0) rotateZ(-360deg);
-moz-transform: rotateZ(360deg) translate3d(0, 50%, 0) rotateZ(-360deg);
transform: rotateZ(-360deg) translate3d(0, 50%, 0) rotateZ(360deg);
}
}
<div class="scrollable">
<div class="inner-container"></div>
<div class="no-scroll">
<div class="line1"></div>
</div>
</div>