如何用CSS向下滚动这个气球

发布于 2025-01-17 05:46:30 字数 3711 浏览 4 评论 0原文

大家好,我正在为我班的学生创建一个项目。

我的问题是我应该如何仅使用 css 将气球在滚动时向下移动到地面。

我只想把气球移到地面上。它看起来就像一个动画视频,气球正在下降,场景正在变化。我的意思是气球从 1 个场景下降到 2 个场景,然后依此类推,我希望您能明白我的意思。

注意:只有气球会在滚动时下降

提前感谢

这是我的代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Moving Balloon animation</title>
    <style>
        *{
            margin:0px;
            padding:0px;
        }
        .container{
            position:absolute;
            z-index:-1;
            width: 100%;
            height: 100vh;
            overflow-y: auto;
            overflow-x: hidden;
            perspective: 10px;
            background-color: black;;
        }
        .container .slide{
            position:relative;
            overflow:hidden;
            z-index:-1;
            width: 100%;
            display:flex;
            float:left;
            background-color: green;
            height: 100%;
            transform-style: preserve-3d;
        }
        .container .slide img{
            position: absolute;
            width: 100%;
            height: 100vh;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="slide slide1">
            <img src="https://drive.google.com/file/d/1WO-MdeOXS72JtuwDE-z6y_d0Q57uCF2x/view?usp=sharing" class="back" alt="">
            <img src="https://drive.google.com/file/d/1ekSyrp8QOTH8o4bF7D2jQoNWeA0g4vor/view?usp=sharing" alt="">
            <img src="https://drive.google.com/file/d/1UbXtFU1-57p1zb-EmqTQfacStDYD_hmr/view?usp=sharing" alt="">
        </div>
        <div class="slide slide2">
            <img src="https://drive.google.com/file/d/1WO-MdeOXS72JtuwDE-z6y_d0Q57uCF2x/view?usp=sharing" class="back" alt="">
            <img src="https://drive.google.com/file/d/18s52rMJQZYd_zsyBMnmjAfjJZ0C2I8uq/view?usp=sharing" alt="">
        </div>
        <div class="slide slide3">
            <img src="https://drive.google.com/file/d/1WO-MdeOXS72JtuwDE-z6y_d0Q57uCF2x/view?usp=sharing" class="back" alt="">
            <img src="https://drive.google.com/file/d/1lHL54riQRwY5yS7KCLCu46Y2NDGfePDo/view?usp=sharing" alt="">
        </div>
        <div class="slide slide4">
            <img src="https://drive.google.com/file/d/1WO-MdeOXS72JtuwDE-z6y_d0Q57uCF2x/view?usp=sharing" class="back" alt="">
            <img src="https://drive.google.com/file/d/1GIK0pyiC8yKY-o57R1f3adG7oaBjG2NH/view?usp=sharing" alt="">
        </div>
        <div class="slide slide5">
            <img src="https://drive.google.com/file/d/1WO-MdeOXS72JtuwDE-z6y_d0Q57uCF2x/view?usp=sharing" class="back" alt="">
        </div>
        <div class="slide slide6">
            <img src="https://drive.google.com/file/d/1WO-MdeOXS72JtuwDE-z6y_d0Q57uCF2x/view?usp=sharing" class="back" alt="">
            <img src="https://drive.google.com/file/d/1SUUXzqcOhZ6Wr3viiwAU6HlIHRdUAka4/view?usp=sharing" alt="">
            <img src="https://drive.google.com/file/d/1Is415tDvd_Rx4HXWGRYW4eleJDgF3wyB/view?usp=sharing" alt="">
            <img src="https://drive.google.com/file/d/1xwXOBHVSurxoAkuMs7oNDoKOdu9d15M1/view?usp=sharing" alt="">
        </div>
    </div>
</body>
</html>

仅气球

Hello again everyone I am creating a project for my class students.

My question is how should I move the balloon down at the ground side on scroll with css only.

I only want to move the balloon down to the ground. It will look like an animation video that which the balloon is going down and the scene is changing. I mean the balloon goes down from 1 scene to 2 scenes and then so on I hope you will get my point.

Note: Only ballon goes down on scroll

THanks in advance

Here is my code

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Moving Balloon animation</title>
    <style>
        *{
            margin:0px;
            padding:0px;
        }
        .container{
            position:absolute;
            z-index:-1;
            width: 100%;
            height: 100vh;
            overflow-y: auto;
            overflow-x: hidden;
            perspective: 10px;
            background-color: black;;
        }
        .container .slide{
            position:relative;
            overflow:hidden;
            z-index:-1;
            width: 100%;
            display:flex;
            float:left;
            background-color: green;
            height: 100%;
            transform-style: preserve-3d;
        }
        .container .slide img{
            position: absolute;
            width: 100%;
            height: 100vh;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="slide slide1">
            <img src="https://drive.google.com/file/d/1WO-MdeOXS72JtuwDE-z6y_d0Q57uCF2x/view?usp=sharing" class="back" alt="">
            <img src="https://drive.google.com/file/d/1ekSyrp8QOTH8o4bF7D2jQoNWeA0g4vor/view?usp=sharing" alt="">
            <img src="https://drive.google.com/file/d/1UbXtFU1-57p1zb-EmqTQfacStDYD_hmr/view?usp=sharing" alt="">
        </div>
        <div class="slide slide2">
            <img src="https://drive.google.com/file/d/1WO-MdeOXS72JtuwDE-z6y_d0Q57uCF2x/view?usp=sharing" class="back" alt="">
            <img src="https://drive.google.com/file/d/18s52rMJQZYd_zsyBMnmjAfjJZ0C2I8uq/view?usp=sharing" alt="">
        </div>
        <div class="slide slide3">
            <img src="https://drive.google.com/file/d/1WO-MdeOXS72JtuwDE-z6y_d0Q57uCF2x/view?usp=sharing" class="back" alt="">
            <img src="https://drive.google.com/file/d/1lHL54riQRwY5yS7KCLCu46Y2NDGfePDo/view?usp=sharing" alt="">
        </div>
        <div class="slide slide4">
            <img src="https://drive.google.com/file/d/1WO-MdeOXS72JtuwDE-z6y_d0Q57uCF2x/view?usp=sharing" class="back" alt="">
            <img src="https://drive.google.com/file/d/1GIK0pyiC8yKY-o57R1f3adG7oaBjG2NH/view?usp=sharing" alt="">
        </div>
        <div class="slide slide5">
            <img src="https://drive.google.com/file/d/1WO-MdeOXS72JtuwDE-z6y_d0Q57uCF2x/view?usp=sharing" class="back" alt="">
        </div>
        <div class="slide slide6">
            <img src="https://drive.google.com/file/d/1WO-MdeOXS72JtuwDE-z6y_d0Q57uCF2x/view?usp=sharing" class="back" alt="">
            <img src="https://drive.google.com/file/d/1SUUXzqcOhZ6Wr3viiwAU6HlIHRdUAka4/view?usp=sharing" alt="">
            <img src="https://drive.google.com/file/d/1Is415tDvd_Rx4HXWGRYW4eleJDgF3wyB/view?usp=sharing" alt="">
            <img src="https://drive.google.com/file/d/1xwXOBHVSurxoAkuMs7oNDoKOdu9d15M1/view?usp=sharing" alt="">
        </div>
    </div>
</body>
</html>

Only balloon

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文