金沙贵宾会官网|金沙贵宾会登录-官网

【A】金沙贵宾会官网超高的返奖率为娱乐者提供资金保障,所以金沙贵宾会登录官网更加的方便了你的娱乐,申请88元彩金,因为在当中不仅仅只有游戏。

使用方法,html5中制作loading图标和图片预览代码

日期:2019-12-21编辑作者:网络技术

jquery插件jTimer(jquery定时器)使用方法

很多时候我们需要按时间间隔执行一个任务,当满足一定条件时停止执行.此插件旨在解决这一经常遇到的问题

 

代码如下:

(function ($) {

    $.extend({

        timer: function (action,context,time) {

            var _金沙贵宾会登录官网 ,timer;

            if ($.isFunction(action)) {

                (function () {

                    _timer = setInterval(function () {

                        if (!action(context)) {

                            clearInterval(_timer);

                        }

                    }, time);

金沙贵宾会官网 ,                })();

            }

        }

    });

})(jQuery);

 

 

代码如下:

<!DOCTYPE html>

<html xmlns=";

<head>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>画布</title>

    <script src="../script/jquery.min.js"></script>

    <script src="../script/jTimer.js"></script>

    <style type="text/css">

        #wrap

        {

            display: table;

            margin: 0 auto;

        }

 

        #cvs

        {

            display: table-cell;

            vertical-align: middle;

        }

    </style>

    <script type="text/javascript">

        function drawRound(context) {            

            if (context.counterclockwise) {

                draw(context.x, context.y, context.r, context.start, context.start - Math.PI / 50, context.counterclockwise);

                context.start -= Math.PI / 50;

                return context.start > 0.5 * Math.PI;

            }

            else {

                draw(context.x, context.y, context.r, context.start, context.start + Math.PI / 50, context.counterclockwise);

                context.start += Math.PI / 50;

                return context.start < Math.PI;

            }

        }

        function draw(x, y, r, sAngle, eAngle, counterclockwise) {

            var cvs = document.getElementById("cvs");

            ctx = cvs.getContext("2d");

            ctx.strokeStyle = "#f00";

            ctx.beginPath();

            ctx.arc(x, y, r, sAngle, eAngle, counterclockwise);

            ctx.stroke();

        }

        $(function () {

            $.timer(drawRound, { x: 100, y: 100, r: 50, start: 1.5 * Math.PI, counterclockwise: true }, 200);

            $.timer(drawRound, { x: 100, y: 100, r: 60, start: 0, counterclockwise: false }, 200);

        });

    </script>

</head>

<body>

    <div id="wrap">

        <canvas id="cvs" height="400" width="500"></canvas>

    </div>

</body>

</html>

 

 

很多时候我们需要按时间间隔执行一个任务,当满足一定条件时停止执行.此插件旨在解决这一经常遇到...

复制代码 代码如下:

html5制作loading图的示例

 

 

代码如下:

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<canvas id = "canvas"></canvas></p> <p> <script>
var Loading = function (canvas, options) {
this.canvas = document.getElementById(canvas);
this.options = options;
};</p> <p> Loading.prototype = {
constructor: Loading,
show: function () {
var canvas = this.canvas,
begin = this.options.begin,
old = this.options.old,
lineWidth = this.options.lineWidth,
canvasCenter = {x: canvas.width / 2, y: canvas.height / 2},
ctx = canvas.getContext("2d"),
color = this.options.color,
num = this.options.num,
angle = 0,
lineCap = this.options.lineCap,
CONST_PI = Math.PI * (360 / num) / 180;
window.timer = setInterval(function () {
ctx.clearRect(0, 0, canvas.width, canvas.height);
for (var i = 0; i < num; i += 1) {
ctx.beginPath();
ctx.strokeStyle = color[num - 1 - i];
ctx.lineWidth = lineWidth;
ctx.lineCap= lineCap;
ctx.moveTo(canvasCenter.x + Math.cos(CONST_PI * i + angle) * begin, canvasCenter.y + Math.sin(CONST_PI * i + angle) * begin);
ctx.lineTo(canvasCenter.x + Math.cos(CONST_PI * i + angle) * old, canvasCenter.y + Math.sin(CONST_PI * i + angle) * old);
ctx.stroke();
ctx.closePath();
}
angle += CONST_PI;
console.log(angle)
},50);
},
hide: function () {
clearInterval(window.timer);
}
};</p> <p> (function () {
var options = {
num : 8,
begin: 20,
old: 40,
lineWidth: 10,
lineCap: "round",
color: ["rgb(0, 0, 0)", "rgb(20, 20, 20)","rgb(40, 40, 40)", "rgb(60, 60, 60)","rgb(80, 80, 80)", "rgb(100, 100, 100)", "rgb(120, 120, 120)", "rgb(140, 140, 140)"]
};
var loading = new Loading("canvas", options);
loading.show();
}());
</script>
</body>

</html>

 

效果图:

金沙贵宾会登录官网 1

 

 

 

(function ($) {
    $.extend({
        timer: function (action,context,time) {
            var _timer;
            if ($.isFunction(action)) {
                (function () {
                    _timer = setInterval(function () {
                        if (!action(context)) {
                            clearInterval(_timer);
                        }
                    }, time);
                })();
            }
        }
    });
})(jQuery);

html5图片上传预览示例分享

 

 

代码如下:

<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8" />
<meta name="author" content="EdieLei" />
<title>HTML5 图片上传预览</title>
<script type="text/javascript" src="<a href=";
<script type="text/javascript">
$(function(){
$('#img').change(function(){
var file = this.files[0]; //选择上传的文件
var r = new FileReader();
r.readAsDataURL(file); //Base64
$(r).load(function(){
$('div').html('<img src="'+ this.result +'" alt="" />');
});
});
});
</script>
</head>
<body>
<h3>HTML5 图片上传预览</h3>
<input id="img" type="file" accept="image/*" />
<div></div>
</body>
</html>

复制代码 代码如下:

<!DOCTYPE html>
<html xmlns=";
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>画布</title>
    <script src="../script/jquery.min.js"></script>
    <script src="../script/jTimer.js"></script>
    <style type="text/css">
        #wrap
        {
            display: table;
            margin: 0 auto;
        }

        #cvs
        {
            display: table-cell;
            vertical-align: middle;
        }
    </style>
    <script type="text/javascript">
        function drawRound(context) {           
            if (context.counterclockwise) {
                draw(context.x, context.y, context.r, context.start, context.start - Math.PI / 50, context.counterclockwise);
                context.start -= Math.PI / 50;
                return context.start > 0.5 * Math.PI;
            }
            else {
                draw(context.x, context.y, context.r, context.start, context.start + Math.PI / 50, context.counterclockwise);
                context.start += Math.PI / 50;
                return context.start < Math.PI;
            }
        }
        function draw(x, y, r, sAngle, eAngle, counterclockwise) {
            var cvs = document.getElementById("cvs");
            ctx = cvs.getContext("2d");
            ctx.strokeStyle = "#f00";
            ctx.beginPath();
            ctx.arc(x, y, r, sAngle, eAngle, counterclockwise);
            ctx.stroke();
        }
        $(function () {
            $.timer(drawRound, { x: 100, y: 100, r: 50, start: 1.5 * Math.PI, counterclockwise: true }, 200);
            $.timer(drawRound, { x: 100, y: 100, r: 60, start: 0, counterclockwise: false }, 200);
        });
    </script>
</head>
<body>
    <div id="wrap">
        <canvas id="cvs" height="400" width="500"></canvas>
    </div>
</body>
</html>

代码如下: (function ($) { $.extend({ timer: function (action,context,time) { var _timer; if ($.isFunction(action)) { (function () { _timer = setInterval(function (...

本文由金沙贵宾会官网发布于网络技术,转载请注明出处:使用方法,html5中制作loading图标和图片预览代码

关键词:

04下无线网卡无法正常连网

ubuntu16.04下无线网卡无法正常连网, 背景:无线网卡初次连接可以正常上网,但是用了一会儿就会出现无法上网的情...

详细>>

基于Docker铺排Lepus及MySQL慢查询配置,安装配备

您可能感兴趣的文章: MySQL性能监控软件Nagios的安装及配置教程 percona-toolkit对MySQL的复制和监控类操作教程 一、环境说...

详细>>

Join算法小结

金沙贵宾会登录官网,MySQL中Nested-Loop Join算法小结,  不知不觉的玩了两年多的MySQL,发现很多人都说MySQL对比Oracle来...

详细>>

详整MySQL数据库如何贯彻相似Oracle的种类,在My

您可能感兴趣的文章: 在MySQL中使用序列的简单教程 mysql自增ID起始值修改方法 mysql如何让自增id归0解决方案 项目应用...

详细>>