顯示具有 clock 標籤的文章。 顯示所有文章
顯示具有 clock 標籤的文章。 顯示所有文章

2012年2月5日 星期日

jquery_clock_fadeto(Jquery)

    var i = 0;
       
            clock();
            function clock(){
                var now,hours,minutes,seconds,time;
                now = new Date();
                hours = now.getHours();
                minutes = now.getMinutes();
                seconds = now.getSeconds();
                time = (hours >= 12) ? "A.M. ":"P.M. ";
                time += ((hours > 12) ? hours - 12 : hours) + " H";
                time += ((minutes < 10) ? " 0" : " ") + minutes + " M";
                time += ((seconds < 10) ? " 0" : " ") + seconds + " S";
                $("#gundamTime .clockBox").html(time);

                if( seconds % 5 == 0){
                    i = i % $(".gundamPic ul li").length;
                    $(".gundamPic ul li").eq(i).fadeTo(1000, 1).css({
                        opacity:1,
                        zIndex: 10
                        }).siblings().fadeTo(2000, 0).css({
                        opacity:0,
                        zIndex:9
                        });
                    i++;
                }
               
                setTimeout(clock,1000);
            }


對之前的 clock  做了修改
背景圖片加了淡入淡出效果 


2012年2月4日 星期六

jqeury_clock+picbur(jquery)

$(function(){
            var i = 0;   
           
            clock();
            function clock(){
                var now,hours,minutes,seconds,time;
                now = new Date();
                hours = now.getHours();
                minutes = now.getMinutes();
                seconds = now.getSeconds();
                time = (hours >= 12) ? "A.M. ":"P.M. ";
                time += ((hours > 12) ? hours - 12 : hours) + " H";
                time += ((minutes < 10) ? " 0" : " ") + minutes + " M";
                time += ((seconds < 10) ? " 0" : " ") + seconds + " S";
                $("#gundamTime .clockBox").html(time);
                if( minutes % 5 == 0){
                    if(i < $(".gundamPic ul li").length){
                        i++;
                    }else{
                        i=0;
                    }
                    $(".gundamPic ul li").eq(i).fadeTo(1000, 1).css('opacity', 1).siblings().fadeTo(2000, 0).css('opacity', 0);
                }
                setTimeout(clock,1000);
            }

        });

jquery_setTimeout_clock(Jquery)

function clock(){
                var now,hours,minutes,seconds,time;
                now = new Date();
                hours = now.getHours();
                minutes = now.getMinutes();
                seconds = now.getSeconds();
                time = (hours >= 12) ? "a.m.":"p.m.";
                time += ((hours > 12) ? hours - 12 : hours) + " H";
                time += ((minutes < 10) ? " 0" : " ") + minutes + " M";
                time += ((seconds < 10) ? " 0" : " ") + seconds + " S";
                $("#gundamTime").html(time);
                setTimeout(clock,1000);
             }