温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

longing加载实例教程

发布时间:2021-11-10 10:39:53 来源:亿速云 阅读:133 作者:iii 栏目:web开发

本篇内容主要讲解“longing加载实例教程”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“longing加载实例教程”吧!

<div class="wrap" id="wrap" style="position: inherit; height: 604px;">
    <div class="main">
        <script src="http://www.zaidu.sn.cn/zaidu/刺激战场争霸赛3/js/canvas.js"></script><div id="loading" class="compatibleStyle">
            <div id="startPlay" style="display: none">开始刺激时刻</div>
            <canvas id="clgass" width="128" height="128"></canvas>
            <script>
            var frame_Imgs_1=['run_1.png','run_2.png','run_3.png','run_4.png','run_5.png','run_6.png','run_7.png','run_8.png','run_9.png','run_10.png','run_11.png','run_12.png','run_13.png','run_14.png','run_15.png','run_16.png',];            //新建动画实例
            var cfa1=new canvasfa({
                    cav:'clgass'//canvas画布id                    ,frames:frame_Imgs_1//帧动画的素材                    ,url:'http://www.zaidu.sn.cn/demo/zaidu_03/img/'//图片路径                    ,fps:24//【可选参数】每秒帧数,默认每秒15帧。(液晶屏每秒刷新60次,所以帧数最好是可以整除60的数)                    ,loop:true//【可选参数】循环播放,false则单次播放并停留在最后一帧,true和默认是循环播放
                    //,autoplay:false//【可选参数】素材加载完毕后是否自动播放; false不播放,true和默认是自动播放。可用 实例对象.start()手动开启播放
                    //,loading_done:alert1//【可选参数】参数需要是一个函数,在素材加载完毕后运行。可缺省此参数。                
            });                
//开始            var _PageHeight = document.documentElement.clientHeight,
    _PageWidth = document.documentElement.clientWidth;//计算loading框距离顶部和左部的距离(loading框的宽度为215px,高度为61px)var _LoadingTop = _PageHeight > 61 ? (_PageHeight - 61) / 2 : 0,
    _LoadingLeft = _PageWidth > 215 ? (_PageWidth - 215) / 2 : 0;//在页面未加载完毕之前显示的loading Html自定义内容var _LoadingHtml = document.getElementById("clgass");//呈现loading效果
                
                /*'<div id="loadingDiv" style="position:absolute;left:0;width:100%;height:' + _PageHeight + 'px;top:0;background:#f3f8ff;opacity:1;filter:alpha(opacity=80);z-index:10000;"><div style="position: absolute; cursor1: wait; left: ' + _LoadingLeft + 'px; top:' + _LoadingTop + 'px; width: auto; height: 57px; line-height: 57px; padding-left: 50px; padding-right: 5px; background: #fff url(Image/loading.gif) no-repeat scroll 5px 10px; border: 2px solid #95B8E7; color: #696969; font-family:\'Microsoft YaHei\';">页面加载中,请等待...</div></div>'*/
                
                document.write(_LoadingHtml);//window.onload = function () {//    var loadingMask = document.getElementById('loadingDiv');//    loadingMask.parentNode.removeChild(loadingMask);//};//监听加载状态改变document.onreadystatechange = completeLoading;//加载状态为complete时移除loading效果function completeLoading() {    if (document.readyState == "complete") {        var loadingMask = document.getElementById('loading');
        loadingMask.parentNode.removeChild(loadingMask);
    }
}    
</script>     
    </div>

到此,相信大家对“longing加载实例教程”有了更深的了解,不妨来实际操作一番吧!这里是亿速云网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI