Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I saw this cool scrolling effect online...

enter image description here

Where the image blends with the next image when scrolling through sections. I've been trying to reproduce it, but I can't seem to figure it out? How can I create this effect on the web?

Here is the link to where I saw the effect... http://readingbuddysoftware.com/how-it-works/

I've tried using position: fixed on the screenshots with the z-index of the section higher then the image, but the last screenshot is always on the top.

Any ideas?

Update: For various reasons (including placement, using slants...), I can't use the background-image css solution. I need a solution for using the <img> element.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
315 views
Welcome To Ask or Share your Answers For Others

1 Answer

This can be done using background-attchement:fixed and two similar images.

Here is a simple example:

body {
  min-height:200vh;
  margin:0;
  background:url(https://picsum.photos/id/1069/150/150?grayscale) 20px 20px no-repeat;
  background-attachment:fixed;
}

.box {
  margin-top:220px;
  height:200px;
  background:url(https://picsum.photos/id/1069/150/150) 20px 20px no-repeat,
  grey;
  background-attachment:fixed;
}
<div class="box">

</div>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...