修复了通过文本滚动动态变化的图像?

发布于 2025-01-29 17:03:51 字数 280 浏览 2 评论 0 原文

我正在尝试重新创建我猜想使用CSS/JS的某种组合的效果:

我希望固定位置图像在页面的左侧保持粘性,而文本滚动段的右侧则是右侧。图像将根据浏览器窗口中可见的文本段落而改变。

录制一个很好的网站:

在此示例中,文本还根据窗口中的位置而更改颜色。对此的简单/复杂的任何帮助或洞察力将不胜感激!

I'm trying to recreate an effect that I'm guessing employs some combination of CSS/JS:

I want a fixed position image to stay sticky on the left side of the page while paragraphs of text scroll to the right of it. The image would change depending on which paragraph of text is visible in the browser window.

Recording of a website that does this well: https://www.loom.com/share/39a65ff6d668485a89b1e2e25b2a11c9

In this example the text also changes color depending on where it is in the window. Any help or insight into how simple/complex this is would be appreciated!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

洛阳烟雨空心柳 2025-02-05 17:03:51

您可以尝试使用element.getBoundingClientRect(),这是一种返回DomRect对象的方法,该对象提供有关元素及其位置的信息。
参考: getBoundingClientRectRect

You can try using Element.getBoundingClientRect(), it's a method that returns a DOMRect object providing information about the size of an element and its position.
Reference: getBoundingClientRect

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文