jquery模仿八卦动态时钟效果

代码语言:html

所属分类:视觉差异

代码描述:jquery模仿八卦动态时钟效果

代码标签: 动态 时钟 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">

    <title>动态时钟</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script type="text/javascript" src="http://repo.bfw.wiki/bfwrepo/js/jquery-3.2.1.min.js"></script>


    <style>

        * {
            margin: 0;
            padding: 0;
        }

        body {
            background-attachment: fixed;
            color: #F5F4F6;
            font-size: 12px;
            font-weight: bold;
            overflow: hidden;
            width: 1000px;
            height: 900px;
            font-family: "微软雅黑";

        }

        audio {
            position: absolute;
            right: 0;
            opacity: 0.1;
            transition: all 1s;

        }

        audio:hover {
            opacity: 1;
        }

        .current {
            color: #D1A3F7;
        }


        video {
            z-index: -1;
            /* object-fit: fill; */
            position: fixed;
            /* right: 0px;
		bottom: 0px; */
            min-width: 100%;
            min-height: 100%;
            /* height: auto;
		width: auto; */
        }


        .main-content {
            position: absolute;
            top: 50%;
            left: 50%;
        }


        .main-content .year {
            position: relative;
            top: -13px;
            left: -38px;
            text-align: center
        }

        .main-content .year span {
            position: absolute;
            width: 80px;
        }



        .main-content .month {
            position: relative;
            top: -13px;
            left: 40px;
        }

        .month span {
            position: absolute;
            width: 60px;

        }




        .main-content .day {
            position: relative;
            top: -13px;
            left: 85px;
        }

        .day span {
            position: absolute;
            width: 65px;

        }




        .main-content .week {
            position: relative;
            top: -13px;
            left: 145px;
        }
        .week span {
            position: absolute;
            width: 65px;

        }


        .main-content .shichen {
            position: relative;
            top: -13px;
            left: 200px;
        }
        .shichen span {
            position: absolute;
            width: 125px;

        }


        .main-content .hour {
            position: relative;
            top: -13px;
            left: 240px;
        }
        .hour span {
            position: absolute;
            width: 60px;

        }


        .main-content .minute {
            position: relative;
            top: -13px;
            left: 300px;
        }
        .minute span {
            position: absolute;
            width: 60px;

        }


        .main-content .second {
            position: relative;
            top: -13px;
            left: 370px;
        }
        .second span {
            position: absolute;
            width: 60px;

        }



    </style>
<script>
    $(document).ready(function () {
    var style = document.styleSheets[0];


    type=config.language_type;
    space=getSpace(12,type);
    $(".main-content .month").css("left",space.month+'px');
    $(".main-content .day").css("left",space.day+'px');
    $(".main-content .week").css("left",space.week+'px');
    $(".main-content .shichen").css("left",space.shichen+'px');
    $(".main-content .hour").css("left",space.hour+'px');
    $(".main-content .minute").css("left",space.minute+'px');
    $(".main-content .second").css("left",space.second+'px');

    
    $("body").css("color",config.font_color);
    style.cssRules[4].style.color=config.pointer_color;



    if(config.sound)
    {
        var ele="<audio controls loop autoplay><source src='sound/"+config.sound_name+"'></audio>"
        $("body").append(ele);
    }


    switch(config.background_style)
    {
        
        case 0:
            var ele1="url('images/"+config.background_picture+"') fixed no-repeat"
            $('body').css('background',ele1);
            $('body').css('background-size','100% 100%');
            break;
        case 1:
            $('body').append('<video loop autoplay muted><source src="video/'+config.background_video+'"></video>')
            break;
        case 2:
            $('body').css('background',config.background_color);
            break;
    }













    var monthLeft=$(".main-content .month").css("left");
    var dayLeft=$(".main-content .day").css("left");
    var weekLeft=$(".main-content .week").css("left");
    var shichenLeft=$(".main-content .shichen").css("left");
    var hourLeft=$(".main-content .hour").css("left");
    var minuteLeft=$(".main-content .minute").css("left");
    var secondLeft=$(".main-content .second").css("left");
    var top=$(".main-content .month").css("top");
    var yearLeft=$(".main-content .year span").width()/2;






    //杩涘叆褰撳墠鏃堕棿
    var Time={
        currentTime:{
            year:1970,
            month:1,
            day:1,
            hour:0,
            minute:0,
            second:0,
            week:0,
            shichen:{}
        },
        months:[],
        days:[],
        hours:[],
        minutes:[],
        seconds:[],
        shichens:[],
        weeks:[],
        hours:[],
        minutes:[],
        seconds:[],
        yearUnit:"骞�",
        monthUnit:"鏈�",
        dayUnit:"鏃�",
        weekUnit:"鏄熸湡",
        hourUnit:"鏃�",
        minuteUnit:"鍒�",
        secondUnit:"绉�"
        
    }
    
    var month=Time.currentTime.month;
    var year=Time.currentTime.year;
    initTime(Time,type);

    


    $(".main-content .year").append("<span class='current'>"+Time.currentTime.year+Time.yearUnit+"</span>");

    var h=$(".year span").height();
    top=-(parseInt(top))-parseInt(h)/2;
    top+="px";


    $(".main-content .month").append(.........完整代码请登录后点击上方下载按钮下载查看

网友评论0