dahlsdata-tahira dahlsdata-tahira - 5 days ago 6
CSS Question

Prevent increasing window-width when sliding out - CSS3 animation

I am applying an animation at a

div
element. The animation slides the element into the viewport and slides it out again. My problem is, that when the element is leaving the viewport, the window-width is increasing. You can see that by the scrollbar at the bottom. How can I prevent that from happen? I want that the window keep its size.

Here is my HTML:

<div class="x1">
<div class="cloud"></div>
</div>


Here you can see the JSFiddle: https://jsfiddle.net/kh7bLdv5/5/

Thanks in advance!

Answer

Simply add overflow-x: hidden to your body tag.

Comments