简体   繁体   English

移动设备中的纯 CSS 加载器动画

[英]Pure CSS loader animation in mobile devices

Good day.再会。 The animation was done on a clean CSS (I understand that i can use the "request animation frame", but I can't use it).动画是在一个干净的 CSS 上完成的(我知道我可以使用“请求动画框架”,但我不能使用它)。 Faced such a problem that the animation works well only in the desktop browser.遇到了动画只能在桌面浏览器中才能正常工作的问题。 "Animation-delay" does not work on mobile devices. “动画延迟”不适用于移动设备。 How can I implement this animation on a clean CSS?如何在干净的 CSS 上实现此动画?

SCSS:社会保障:

.initial-loader {
display: block;
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
z-index: 1000;

display: flex;
justify-content: center;
align-items: center;

background: #65B200;

&_disabled {
    display: none;
}

&__wrapper {
    height: 0%;
    width: auto;

    display: flex;
    justify-content: center;
}

&__loader {
    width: 60px;
    height: 8px;
    align-self: flex-end;

    display: flex;
    justify-content: space-around;
}

&__loader span {
    height: 8px;
    width: 8px;
    background-color: white;
    border-radius: 100%;
}

&__loader :nth-child(1) {
    animation: anime 0.5s infinite ease-in-out alternate;
}

&__loader :nth-child(2) {
    animation: anime 0.5s infinite ease-in-out alternate;
    -moz-animation-delay: 120ms;
    -webkit-animation-delay: 120ms;
    -o-animation-delay: 120ms;
    animation-delay: 120ms;
}

&__loader :nth-child(3) {
    animation: anime 0.5s infinite ease-in-out alternate;
    animation-delay: 240ms;
}

&__loader :nth-child(4) {
    animation: anime 0.5s infinite ease-in-out alternate;
    animation-delay: 360ms;
}

&__loader :nth-child(5) {
    animation: anime 0.5s infinite ease-in-out alternate;
    animation-delay: 480ms;
}

@keyframes anime {
    from {
        transform: scale(1)
    }

    to {
        transform: scale(0.2)
    }
}

HTML: HTML:

<div class="initial-loader">
        <div class="initial-loader__wrapper">
            <div class="initial-loader__loader">
                <span></span>
                <span></span>
                <span></span>
                <span></span>
                <span></span>
            </div>
        </div>
</div>

Here my code: https://codepen.io/koofem/pen/MWYoYxE这是我的代码: https : //codepen.io/koofem/pen/MWYoYxE

How does it works in the desktop browser它在桌面浏览器中是如何工作的

How does it works on mobile它如何在移动设备上运行

Mobile devices has webkit browsers, if the same CSS is working on desktops and not on Mobile Devices, then make sure your css has prefixes for all different browsers and devices.移动设备有 webkit 浏览器,如果相同的 CSS 在桌面上工作而不是在移动设备上,那么请确保您的 css 具有适用于所有不同浏览器和设备的前缀。

You have had done it for :nth-child(2) but not for all other selected elements and classes.您已经为 :nth-child(2) 完成了它,但没有为所有其他选定的元素和类完成。

Best shortcut is to goto CSS Autiprefixer and give it a shot by copy pasting your CSS and try to test on mobile device again (Obviously after clearing cache of the Mobile Device's Browser)最好的捷径是转到CSS Autiprefixer并通过复制粘贴 CSS 试一试,然后再次尝试在移动设备上进行测试(显然是在清除移动设备浏览器的缓存后)

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

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