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>
  • 相关阅读:
    Idea debug报错Command line is too long
    云计算与虚拟化入门通识
    yield from语法
    python中 os._exit() 和 sys.exit(), exit(0)和exit(1) 的用法和区别
    python模块中sys.argv[]使用
    SQLAlchemy中Model.query和session.query(Model)的区别
    MAN VGEXTEND
    Python---基础---dict和set
    Python---基础---元组
    Python---基础---list(列表)
  • 原文地址:https://www.cnblogs.com/bluen/p/5480539.html
Copyright © 2011-2022 走看看