English 中文(简体)
我需要一个时间来估计和显示在酒吧取得的进展。
原标题:I need a timer which counts and show progress in jQuery

我需要一个时间来评估并显示这方面的进展:

enter image description here

在中部和中部将有一个两分钟的柜台。 我怎么能够这样做呢?

最佳回答

you could implement it on modern browser using canvas. I took a look at https://developer.mozilla.org/en/Canvas_tutorial/Drawing_shapes under "Arcs" section and I came to this solution (a fiddle is linked below)

HTML5

<!DOCTYPE HTML>
<html>  
    <head>  
      <title>Canvas circular timer</title>  
    </head>
    <body>  
        <div>
            <canvas id="timer" width="100" height="100"></canvas>
            <span id="counter">20</span>
        </div>
    </body>  
</html>   

<>CSS

canvas {
   -webkit-transform : rotate(-90deg);  
   -moz-transform : rotate(-90deg);
}

div { position: relative; z-index: 1; height: 100px; width: 100px; }
div span {
    position   : absolute;
    z-index    : 1;
    top        : 50%;
    margin-top : -0.6em;
    display    : block;
    width      : 100%;
    text-align : center;
    height     : 1.5em;
    color      : #0e0;
    font       : 1.5em Arial;
}

http://www.ohchr.org。

window.onload = function() {
    var canvas  = document.getElementById( timer ),
        seconds = document.getElementById( counter ),
        ctx     = canvas.getContext( 2d ),
        sec     = seconds.innerHTML | 0,
        countdown = sec;

    ctx.lineWidth = 6;
    ctx.strokeStyle = "#00EE00";

    var
    startAngle = 0,
    time       = 0,
    intv       = setInterval(function(){

        var endAngle = (Math.PI * time * 2 / sec);
        ctx.arc(50, 50, 35, startAngle , endAngle, false);   
        startAngle = endAngle;
        ctx.stroke();

        seconds.innerHTML = countdown--;

        if (++time > sec) { clearInterval(intv); }

    }, 1000);

}

http://jsfiddle.net/2qyEv/“rel=“nofollow” http://jsfiddle.net/2qyEv/。 (与Catherine和Webkit合任)

注:其余二字不是在信封内写的,而是放在一个<条码>和代号;中,放在信封上。 这样做——执行退步逻辑——不支持信道的老浏览器至少可以显示减员。 如果你不需要这种优化,那么这种偏差只能用于文字和图象:。 http://jsfiddle.net/9L48R/

我请你用 j树取代 j字。

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签