简体   繁体   English

CSS过渡在身体溢出中的可滚动div上不起作用:隐藏

[英]Css transition not working on scrollable div in body overflow:hidden

I want to use this header effect on the website I am working on but with some modifications. 我想在正在工作的网站上使用此标题效果 ,但需要进行一些修改。 I need to implement this on div instead of header. 我需要在div而不是header上实现它。 The problem is that this js/css effect is not working with my css which is: 问题是这种js / css效果不适用于我的CSS,即:

body{ width:100%; overflow:hidden; }

Since I need this to be on some div that is scrollable I think it is not a big problem to make that possible. 由于我需要将其放在可滚动的div上,因此我认为将其变为可能并不是一个大问题。 I just don't understand javascript so much and that is why I need your help. 我只是不太了解javascript,因此我需要您的帮助。 Here i made jsfiddle with working animation where you can see all external js/css. 在这里,我用工作动画制作了jsfiddle ,您可以在其中看到所有外部js / css。

Thanks in advance! 提前致谢!

If you set overflow to hidden on the body it will cut the text to the body size, so you will be unable to scroll. 如果将溢出设置为隐藏在正文上,则会将文本剪切为正文大小,因此您将无法滚动。 You can use overflow: scroll or auto (that will set it to scroll because the text is bigger than the body). 您可以使用overflow: scrollauto (由于文本大于正文,因此将其设置为scroll )。 In that way all your content will be rendered. 这样,您的所有内容都将被呈现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM