zoukankan      html  css  js  c++  java
  • step ctrl

    window.$stepCtrl = {
        elementData:{},
        targetContents:{},
        onload:function(){
            var elements = document.getElementsByClassName('laz-steps');
            try{
                for (var i in elements){
                    var element = elements[i];
                    if (is_element(element)){
                        var key = element.getAttribute("laz-key");
                        var idx = element.getAttribute('laz-step-index');
                        if (!this.elementData[key])
                        {
                            this.elementData[key] = {
                                "index-now":-1,
                                elements:{}
                            };
                        }
                        this.elementData[key]['elements'][parseInt(idx)] = element;
                        if (idx == 0){
                            this.nextStep(key);
                        }
                    }
                }
            }catch (e){
                console.warn(e);
            }
        },
        nextStep:function(key){
            try{
                var idx = this.elementData[key]['index-now'];
                if (idx != -1){
                    this.elementData[key]['elements'][idx].setAttribute("laz-active","hide");
                }
                idx ++;
                this.elementData[key]['elements'][idx].setAttribute("laz-active","show");
                this.elementData[key]['index-now'] = idx;
            }catch (e){
                console.warn(e);
            }
        },
        lastStep:function(key){
            try{
                var idx = this.elementData[key]['index-now'];
                if (idx != -1){
                    this.elementData[key]['elements'][idx].setAttribute("laz-active","hide");
                }
                if (idx > 0){
                    idx --;
                    this.elementData[key]['elements'][idx].setAttribute("laz-active","show");
                    this.elementData[key]['index-now'] = idx;
                }
            }catch (e){
                console.warn(e);
            }
        }
    
    };
            <div class="laz-steps" laz-step-index="0" laz-key="register">
                <form method="post" laz-action="" laz-call="step1" onsubmit="return LazFormCheck(this);">
                    <div class="std-form-group">
                        <label>邀请人手机号</label>
                        <input type="text"  name="inviter" class="std-form-control"/>
                    </div>
                    <button type="submit" class="std-btn std-btn-warning">下一步</button>
                </form>
            </div>
  • 相关阅读:
    SDUT-2131_数据结构实验之栈与队列一:进制转换
    HDU-6290_奢侈的旅行(Dijstra+堆优化)
    SDUT-2054_数据结构实验之链表九:双向链表
    SDUT-3331_数据结构实验之链表八:Farey序列
    Ubuntu安装redis
    magento2站点迁移
    JS 代码中到底加不加分号
    magento2常见的命令
    ngx_pagespeed-nginx前端优化模块介绍
    搜索引擎网站收录地址大全
  • 原文地址:https://www.cnblogs.com/bluen/p/5480539.html
Copyright © 2011-2022 走看看