【问题标题】:iPhone (Safari and Chrome both) position: fixed bug?iPhone(Safari 和 Chrome 都有)位置:修复错误?
【发布时间】:2017-12-20 02:09:00
【问题描述】:

我有这个网站

在桌面上一切正常,但在 iPhone 上(Safari 和 Chrome 都有)我的预加载器有问题:

Bug screenshot

CSS:

    .preloader_wrapper {
        position: fixed;
        left: 0;
        top: 0;
        right: 0;
        bottom: 0;
        background: #000;
        z-index: 100500;
    }
    .preloader {
        position: relative;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        border-radius: 50%;
        width: 50px;
        height: 50px;
    }
    .preloader::before {
        content: '';
        position: absolute;
        box-sizing: border-box;
        top: 0;
        left: 0;
        width: 50px;
        height: 50px;
        border-radius: 50%;
        border: 4px solid #951b25;
        border-left-color: transparent;
        border-right-color: transparent;
        animation: spin 1s linear infinite; 
    }
    @keyframes spin {
        0% {
            transform: rotate(0deg) scale(1);
        }
        50% {
            transform: rotate(45deg) scale(1.2);
        }
        100% {
            transform: rotate(360deg) scale(1);
        }
    }

HTML:

   <div class="preloader_wrapper">
        <div class="preloader"></div>
    </div>

由于我的谷歌搜索,我认为问题已解决。如何解决?

【问题讨论】:

    标签: html ios css iphone


    【解决方案1】:

    嗯,我认为 .preloader 绝对定位可能会解决它。我现在正在打电话,所以无法测试。否则我建议尝试显示;柔性;在 .preloader_wrapper 上使用 justify 和 alignment 道具,并从 .preloader 本身中删除所有定位内容。

    【讨论】:

    • 谢谢,flex 解决了这个问题。但我真的很感兴趣为什么 .preloader 相对定位在 iPhone 上不起作用..
    • 这是因为关键帧正在重置变换 xy 值。如果您也将转换道具添加到这些道具中,它应该可以工作。
    猜你喜欢
    • 2012-09-25
    • 2016-03-27
    • 1970-01-01
    • 1970-01-01
    • 2018-07-21
    • 1970-01-01
    • 2011-01-24
    • 2016-01-06
    • 1970-01-01
    相关资源
    最近更新 更多