简体   繁体   English

让 HTML/CSS/JS 部分飞入

[英]Let HTML/CSS/JS sections fly in

I'm working on a website, now I want that when you scroll, the respective section flies in (from the left).我在一个网站上工作,现在我希望当你滚动时,相应的部分会飞进来(从左边)。 I'm not really getting anywhere though, would be nice if someone can help me.不过,我并没有真正到达任何地方,如果有人可以帮助我,那就太好了。

A section looks like this:一个部分如下所示:

<section>
<h2>title</h2>
<div>Text and other elements</div>
</section>

CSS: CSS:

section {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem;
  animation: text 3s 1;
}


@media (max-width: 1012px) {
  section {
    width: 90%;
  }
}

I don't know if this is what you're looking我不知道这是不是你要找的

 body { height: 200vh; } #flying { position: sticky; top: 10px; margin: 5px; width: 100px; height: 100px; background-color: green; }.others { width: 100px; height: 100px; background-color: blue; margin: 5px; }
 <div id="flying"></div> <div class="others"></div> <div class="others"></div> <div class="others"></div>

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

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