zoukankan      html  css  js  c++  java
  • 加载中三个点点动态出现

    js定时器方法

    //html
    <div>加载中<span id="dot"></span></div>
    
    //js
    <script>
     let dotting = function () {
            let dom = document.getElementById('dot');
            let html = dom.innerHTML;
            if(html.length >= 3){
                dom.innerHTML = ''
            } else {
                dom.innerHTML = html + '.'
            }
        }
        setInterval(dotting, 800)
    
    </script>

    方法都来自于网上其他博客  

    css3 anminate方法  

    方法1:

    //html
    <div>加载中<span id="dot">...</span></div>
    
    //css
    <style>  
    #dot {
        display: inline-block;
         1.5em;
        vertical-align: bottom;
        overflow: hidden;
        animation: dotting 3s infinite step-start;
    }
    @keyframes dotting{
        0% {  0; margin-right: 1.5em; }
        33% {  .5em; margin-right: 1em; }
        66% {  1em; margin-right: .5em; }
        100% {  1.5em; margin-right: 0;}
    }
    </style>
    

      

    方法2:  这个方法的好处是可以方便的设置大小

    //html
    <div>加载中<span id="dot"></span></div>
    //css
    <style>
    #dot{
        height: 4px;
         4px;
        display: inline-block;
        border-radius: 2px;
        animation: dotting 2.4s  infinite step-start;
    }
    @keyframes dotting {
        25%{
            box-shadow: 4px 0 0 #000;
        }
        50%{
            box-shadow: 4px 0 0 #000000 ,14px 0 0 #000;
        }
        75%{
            box-shadow: 4px 0 0 #000 ,14px 0 0 #000, 24px 0 0 #000;
        }
    }
    </style>
    

      

    还有其他很多种方法啦,效果出来就行 

  • 相关阅读:
    原生ajax与伪ajax
    ModelForm操作
    django学习笔记(四)
    django学习笔记(五)
    java.lang.NoClassDefFoundError: org/apache/poi/xwpf/usermodel/IRunBody异常
    springBoot项目mybatis中加入缓存
    Linux搭建MongoDB
    java搭建分布式项目
    Linux安装Apollo
    Foxmail公司邮箱配置
  • 原文地址:https://www.cnblogs.com/Anne3/p/10954609.html
Copyright © 2011-2022 走看看