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);
            }

        });

沒有留言:

張貼留言