layui实现的一个带答题进度条的答题系统效果代码

代码语言:html

所属分类:布局界面

代码描述:layui实现的一个带答题进度条的答题系统效果代码

代码标签: 一个 答题 进度 答题 系统 效果

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

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
    content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/js/layui/css/layui.css">
    <style>
        .list {
            width: 100%;
            display: none;
            margin: 20px 0 0 0;
        }
        #list1 {
            display: block;
        }
        label {
            font-weight: bold;
        }
        .layui-layer {
            width: 600px;
            margin: 0 auto;
        }
        #color {
            background: -webkit-linear-gradient(left,#147B96,#E6D205 25%,#147B96 50%,#E6D205 75%,#147B96);
            color: transparent;
            -webkit-background-clip: text;
            background-size: 200% 100%;
            animation: masked-animation 1s infinite linear;
        }
@-webkit-keyframes masked-animation {
            100% {
                background-position: -100% 0;
            }
        }
    </style>
</head>
<body>

    <div style="width:480px; margin:40px auto;">

        <!--这里是点击开始按钮启动,可有可无 <div style="text-align: center;" class="bg">
        		<button class="layui-btn layui-btn-group" onClick="contentShow()">答题开始</button>
        	</div>-->

        <div class="layui-progress layui-progress-big" lay-filter="demo" lay-showPercent="true">
            <div class="layui-progress-bar layui-bg-blue" lay-percent="1%"></div>
        </div>

        <div>
            <div class="list" id="list1">
                <label class="layui-font-20">1:中国共产党宣布成立的地方是哪里?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh1" name="wh1" value="a" title="A:浙江嘉兴南湖红船">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh1" name="wh1" value="b" title="B:浙江嘉兴南湖会景园">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh1" name="wh1" value="c" title="C:浙江嘉兴南湖勺园">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh1" name="wh1" value="d" title="D:浙江嘉兴南湖英雄园">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list2">
                <label class="layui-font-20">2:中国共产党宣布成立的正确日期?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh2" name="wh2" value="a" title="A:1921-7-1">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh2" name="wh2" value="b" title="B:1921-7-10">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh2" name="wh2" value="c" title="C:1921-7-23">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh2" name="wh2" value="d" title="D:1921-7-5">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list3">
                <label class="layui-font-20">3:长征开始的时间是?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh3" name="wh3" value="a" title="A:1934-7">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh3" name="wh3" value="b" title="B:1934-10">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh3" name="wh3" value="c" title="C:1934-9">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh3" name="wh3" value="d" title="D:1934-6">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list4">
                <label class="layui-font-20">4:下列那场战斗不属于长征期间的战斗?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh4" name="wh4" value="a" title="A:四渡赤水">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh4" name="wh4" value="b" title="B:巧夺卢沟桥">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh4" name="wh4" value="c" title="C:飞夺泸定桥">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh4" name="wh4" value="d" title="D:巧渡金沙江">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list5">
                <label class="layui-font-20">5:抗日战争打了几年?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh5" name="wh5" value="a" title="A:10年">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh5" name="wh5" value="b" title="B:8年">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh5" name="wh5" value="c" title="C:14年">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh5" name="wh5" value="d" title="D:11年">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list6">
                <label class="layui-font-20">6:"九一八"事变发生在哪里?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh6" name="wh6" value="a" title="A:沈阳">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh6" name="wh6" value="b" title="B:北平">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh6" name="wh6" value="c" title="C:辽宁">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh6" name="wh6" value="d" title="D:长春">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list7">
                <label class="layui-font-20">7:中华民族全面抗战的起点是哪个事件?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh7" name="wh7" value="a" title="A:'九一八'事变">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh7" name="wh7" value="b" title="B:七七事变">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh7" name="wh7" value="c" title="C:淞沪抗战">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh7" name="wh7" value="d" title="D:武汉会战">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list8">
                <label class="layui-font-20">8:抗日战争首次集中较大兵力对日军进行的一次成功伏击战指的是那场战役?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh8" name="wh8" value="a" title="A:淞沪抗战">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh8" name="wh8" value="b" title="B:台儿庄战役">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh8" name="wh8" value="c" title="C:平型关大捷">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh8" name="wh8" value="d" title="D:南京保卫战">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list9">
                <label class="layui-font-20">9:平型关大捷的主指挥是谁?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh9" name="wh9" value="a" title="A:彭德怀">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh9" name="wh9" value="b" title="B:林彪">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh9" name="wh9" value="c" title="C:陈赓">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh9" name="wh9" value="d" title="D:刘伯承">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list10">
                <label class="layui-font-20">10:抗日期间八路军在华北敌后发动的一次大规模进攻和反“扫荡”的战役是那场战役?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh10" name="wh10" value="a" title="A:太原会战">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh10" name="wh10" value="b" title="B:桂南会战">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh10" name="wh10" value="c" title="C:徐州会战">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh10" name="wh10" value="d" title="D:百团大战">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list11">
                <label class="layui-font-20">11:"百团大战"具体有多少个团参加其战役?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh11" name="wh11" value="a" title="A:104个">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh11" name="wh11" value="b" title="B:106个">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh11" name="wh11" value="c" title="C:105个">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh11" name="wh11" value="d" title="D:110个">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list12">
                <label class="layui-font-20">12:解放战争开始于什么时候?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh12" name="wh12" value="a" title="A:1946-6">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh12" name="wh12" value="b" title="B:1946-8">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh12" name="wh12" value="c" title="C:1946-9">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh12" name="wh12" value="d" title="D:1946-7">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list13">
                <label class="layui-font-20">13:下列那场战役不属于解放战争期间的发生战役?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh13" name="wh13" value="a" title="A:辽沈战役">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh13" name="wh13" value="b" title="B:徐州会战">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh13" name="wh13" value="c" title="C:淮海战役">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh13" name="wh13" value="d" title="D:平津战役">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list14">
                <label class="layui-font-20">14:解放战争最后一次大规模战役被称为什么战役?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh14" name="wh14" value="a" title="A:淮海战役">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh14" name="wh14" value="b" title="B:辽沈战役">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh14" name="wh14" value="c" title="C:平津战役">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh14" name="wh14" value="d" title="D:渡江战役">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list15">
                <label class="layui-font-20">15:抗美援朝发生于什么什么时候?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh15" name="wh15" value="a" title="A:1950-10">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh15" name="wh15" value="b" title="B:1950-7">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh15" name="wh15" value="c" title="C:1950-1">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh15" name="wh15" value="d" title="D:1950-11">
                        </div>
                    </div>
                </div>
            </div>
            <div class="list" id="list16">
                <label class="layui-font-20">16:咱们公司谁最有钱?</label>
                <div class="layui-form">
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh16" name="wh16" value="a" title="A:曹伟伟">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh16" name="wh16" value="b" title="B:孙书华">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh16" name="wh16" value="c" title="C:杨梅">
                        </div>
                        <div class="layui-input-block">
                            <input type="radio" lay-filter="wh16" name="wh16" value="d" title="D:张艳">
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>


    <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/layui/layui.all.js"></script>
    <script>
        layui.use(['layer', 'element', 'form', 'jquery'], function() {
            var $ = layui.jquery,
            layer = layui.layer,
            element = layui.element,
            form = layui.form;
            form.on('radio(wh1)', function(data) {
                if (data.value == 'a') {
                    layer.open({
                        title: '回答正确',
                        btn: '下一题',
                        content: "7月底,中共一大代表毛泽东、董必武、陈潭秋、王尽美、邓恩铭、李达等,由李达夫人王会悟做向导,从上海乘火车转移到嘉兴,再从狮子汇渡口登上渡船到湖心岛,最后转登王会悟预订的游船,并在游船中庄严宣告中国共产党的诞生。在船上,中共一大通过了党的第一个纲领和决议,正式宣告中国共产党庄严诞生。",
                        yes: function (index, layero) {
                            $('#list1').hide();
                            $('#list2').show();
                            layer.close(index);
                            element.progress('demo', '6%');
                        }
                    })
                } else {
                    layer.open({
                        btn: '下一题',
                        content: "正确答案是:A:浙江嘉兴南湖红船:7月底,中共一大代表毛泽东、董必武、陈潭秋、王尽美、邓恩铭、李达等,由李达夫人王会悟做向导,从上海乘火车转移到嘉兴,再从狮子汇渡口登上渡船到湖心岛,最后转登王会悟预订的游船,并在游船中庄严宣告中国共产党的诞生。在船上,中共一大通过了党的第一个纲领和决议,正式宣告中国共产党庄严诞生。",
                        yes: function (index, layero) {
                            $('#list1').hide();
                            $('#list2').show();
                            layer.close(index);
                            element.progress('demo', '6%');
                        }
                    })
                }

            });
            form.on('radio(wh2)',
                function(data) {
                    if (data.value == 'c') {
                        layer.open({
                            title: '回答正确',
                            btn: '下一题',
                            content: "1921年7月23日—31日,在上海召开了中国共产党的第一次全国代表大会。",
                            yes: function (index, layero) {
                                $('#list2').hide();
                                $('#list3').show();
                                layer.close(index);
                                element.progress('demo', '12%');
                            }
                        })
                    } else {
                        layer.open({
                            btn: '下一题',
                            content: "正确答案是:C:1921-7-23:1921年7月23日—31日,在上海召开了中国共产党的第一次全国代表大会。",
                            yes: function (index, layero) {
                                $('#list2').hide();
                                $('#list3').show();
                                layer.close(index);
                                element.progress('demo', '12%');
                            }
                        })
                    }

                });
            form.on('radio(wh3)',
                function(data) {
                    if (data.value == 'b') {
       .........完整代码请登录后点击上方下载按钮下载查看

网友评论0