>  기사  >  웹 프론트엔드  >  플러그인 로드를 기다리는 매우 멋진 CSS3 애니메이션 jquery.loding

플러그인 로드를 기다리는 매우 멋진 CSS3 애니메이션 jquery.loding

高洛峰
高洛峰원래의
2016-11-24 09:37:521410검색

스크린샷 효과는 별로 좋지 않은 것 같습니다. CSS3를 지원하는 최신 브라우저가 필요합니다. 코드가 많지 않으며 기본적으로 주석이 필요하지 않습니다. jQuery 플러그인 모드로 캡슐화되었습니다. 필요한 것을 가져가면 됩니다.

[javascript] 
/*
* JQuery loading Plugin
* http://blog.csdn.net/sweetsuzyhyf
*
* Licensed same as jquery - MIT License
* http://www.opensource.org/licenses/mit-license.php
*
* Author: hyf
* Email: 36427561@qq.com
* Date: 2012-11-15
*/ 
$.loading = function (param) { 
    var option = $.extend({ 
        id: 'loading',      //唯一标识 
        parent: 'body',     //父容器 
        msg: ''             //提示信息 
 
    }, param || {}); 
    var obj = {}; 
    var html = &#39;<table id=&#39; + option.id + &#39; class="loading">&#39; + 
                    &#39;<tr>&#39; + 
                        &#39;<td>&#39; + 
                            &#39;<div class="circle">&#39; + 
                            &#39;</div>&#39; + 
                            &#39;<div class="circle1">&#39; + 
                            &#39;</div>&#39;; 
    if (option.msg) { 
        html += &#39;<div class="msg"><p class="shine">&#39; + option.msg + &#39;</p></div>&#39;; 
    } 
    html += &#39;</td></tr></table>&#39;; www.2cto.com
    var loading = $(html).appendTo(option.parent); 
 
    return { 
        play: function () { 
            $(&#39;.circle,.circle1,.shine&#39;, loading).toggleClass(&#39;stop&#39;); 
        }, 
        pause: function () { 
            $(&#39;.circle,.circle1,.shine&#39;, loading).toggleClass(&#39;stop&#39;); 
        }, 
        close: function () { 
            loading.remove(); 
        } 
    }; 
};
[css] 
/*加载等待样式*/ 
.loading 
{ 
    width:100%; 
    height:100%; 
    vertical-align:middle; 
} 
.loading td 
{ 
    text-align:center; 
} 
.loading .circle { 
    background-color: rgba(0,0,0,0); 
    border:5px solid rgba(0,183,229,0.9); 
    opacity:.9; 
    border-right:5px solid rgba(0,0,0,0); 
    border-left:5px solid rgba(0,0,0,0); 
    border-radius:50px; 
    box-shadow: 0 0 35px #2187e7; 
    width:50px; 
    height:50px; 
    margin:0 auto; 
    -webkit-animation:spinPulse 1s infinite linear; 
} 
.loading .circle1 { 
    background-color: rgba(0,0,0,0); 
    border:5px solid rgba(0,183,229,0.9); 
    opacity:.9; 
    border-left:5px solid rgba(0,0,0,0); 
    border-right:5px solid rgba(0,0,0,0); 
    border-radius:50px; 
    box-shadow: 0 0 15px #2187e7; 
    width:30px; 
    height:30px; 
    margin:0 auto; 
    position:relative; 
    top:-50px; 
    -webkit-animation:spinoffPulse 1s infinite linear; 
} 
@-webkit-keyframes spinPulse { 
    0% { -webkit-transform:rotate(160deg); opacity:0; box-shadow:0 0 1px #2187e7; } 
    50% { -webkit-transform:rotate(145deg); opacity:1;} 
    100% { -webkit-transform:rotate(-320deg); opacity:0; } 
} 
@-webkit-keyframes spinoffPulse { 
    0% { -webkit-transform:rotate(0deg); } 
    100% { -webkit-transform:rotate(360deg); } 
} 
.loading .stop { 
    -webkit-animation-play-state:paused; 
} 
.loading .msg 
{ 
    display:inline-block; 
    font-size: 12px; 
    position:relative; 
    top:-30px; 
    color:#ccc; 
    display:inline-block; 
} 
@-webkit-keyframes shine 
{ 
    0% 
    { 
        background-position: top left; 
    } 
    100% 
    { 
        background-position: top right; 
    } 
} 
.shine 
{ 
    background: #222 -webkit-gradient(linear, left top, right top, from(#000), to(#000), color-stop(0.5, #fff)) 0 0 no-repeat; 
    -webkit-background-size: 30% 100%; 
    color: rgba(48,196,233, 0.3); 
    -webkit-background-clip: text; 
    -webkit-animation-name: shine; 
    -webkit-animation-duration: 2s; 
    -webkit-animation-iteration-count: infinite; 
} 
/*加载等待样式end*/


성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.