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>
    

      

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

  • 相关阅读:
    Mac 删除Openfire
    FMDB使用
    豆瓣restful api 状态和错误码
    豆瓣开放api
    常用文字配色方案
    电商网站参考
    HP后端跨域HEADER头
    PHP统计 图表实现方法
    PHP 全过程教程和测试网
    Ajax技术在购物车中的应用(PHP篇)
  • 原文地址:https://www.cnblogs.com/Anne3/p/10954609.html
Copyright © 2011-2022 走看看