English 中文(简体)
多个事件的频率
原标题:Jquery Countdown timer for multiple events

这就是我的问题。 我正在为会议厅浏览一个网站。 客户希望下届主页会议倒数。 页: 1 既然它有我所需要的一切。 但是,由于会议厅每天有多次会议,我需要缩减到下届会。 我知道每天所有会议的日期和时间,但我不知道我如何能够在到期时转向下一次会议。 任何想法?

最佳回答

这不是像基思伍德这样的40Kb解决办法。 但是,经过5个小时的手法,我提出了这一非常多变的解决办法:

<script type= text/javascript  src= jquery-1.5.1.min.js ></script>
<script type= text/javascript >

    function countDown(eventID) {
        var $this, h, m, s;
        $this = $( #event +eventID);
        s = parseInt($this.text().substr(6),10);
        m = parseInt($this.text().substr(3,5),10);
        h = parseInt($this.text().substr(0,2),10);
        s--;
        m = (s < 0) ? --m : m;
        h = (m < 0) ? --h : h;
        if (h < 0) {
            $this.css( display , none );
            $this.parent().slideUp( slow );
            $this.parent().remove();
        }
        s = (s < 0) ? 59 : s;
        m = (m < 0) ? 59 : m;
        $this.text(((h < 10) ?  0 +h : h)+ : +((m < 10) ?  0 +m : m)+ : +((s < 10) ?  0 +s : s));
        setTimeout( countDown( +eventID+ ) ,1000);
        $( .counter ).first().show();
    }

    $(document).ready( function() {
        var eventID = 0; 
        $( #nextEvents div ).each( function () {
            var nextEventH = parseInt($(this).text().substring(0,2),10);
            var nextEventM = parseInt($(this).text().substring(3,5),10);
            var nextEventS = $(this).text().substring(5,7);
            nextEventH = (nextEventS ===  PM ) ? nextEventH + 12 : nextEventH;
            nextEventS = 0;
            var curTime = new Date();
            //curTime = curTime.getHours()+ : +curTime.getMinutes()+ : +curTime.getSeconds();
            nextEventH = Math.abs(nextEventH - curTime.getHours());
            nextEventH = (nextEventH < 10) ?  0 +nextEventH : nextEventH;
            nextEventM = Math.abs(nextEventM - curTime.getMinutes());
            nextEventM = (nextEventM < 10) ?  0 +nextEventM : nextEventM;
            nextEventS = Math.abs(nextEventS - curTime.getSeconds());
            nextEventS = (nextEventS < 10) ?  0 +nextEventS : nextEventS;
            $(this).append("<div class= counter  id= event"+eventID+"  style= display:none; "+
                "position:absolute; top:0; right:0; width:auto; height:auto; color:red;   >"+
                nextEventH +  :  + nextEventM +  :  + nextEventS+"</div>");
            countDown(eventID);
            eventID++;
        });
    });

</script>

</head>

<body>
   <div id= wrapper  style= position:relative; width:600px; height:400px; background-color:#366; color:#EEE;   >
    <div id= nextEvents  >
     <div style= position:relative; width:100%; display:block;   >05:12AM - Meeting with department heads</div>
     <div style= position:relative; width:100%; display:block;   >05:13AM - Meeting with Department of Finances</div>
     <div style= position:relative; width:100%; display;block;   >05:14AM - Meeting with Human Resources</div>
    </div>
   </div>
问题回答

冲淡面粉碎块的参数是“Expiry”,这是一种退税功能,每当倒数达到零时即执行。 在这项职能方面,你可以(a) 计算下一次会议的日期,(b) 将“直至”计票场改为这一数值。

例如:

传真

<html>
    <body>
        <div id="countdown"></div>
    </body>
</html>

Java

$( #countdown ).countdown(
    {
        until: getNextMeeting(),
        onExpiry:
            function()
            {
                $(this).countdown("change", "until", getNextMeeting());
            }
    }
);

function getNextMeeting()
{
    // Based on the current time, figure out the next meeting time here:
    now = new Date();
    return now;
}

我举了一个例子,说明每5秒钟的休息时间。 当然,你想要调整,以计算实际会议时间:

http://jsfiddle.net/wXYSZ/"rel=“nofollow> http://jsfiddle.net/wXYSZ/

希望这一帮助!





相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

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.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签