zoukankan      html  css  js  c++  java
  • js组件常用封装方法。。。。。【组件封装】 ★★★★★★ 1月会员日 集人气【弹窗】

    公共弹窗js写法:mcake弹窗封装Dialog.js

    function Dialog(bg,els,opts) {
        this.$els = $(els);
        this.$Dialogbg = $(bg);
        this.$close = this.$els.find(opts.close);
        this.$btn = this.$els.find(opts.btn);
        this._init();
    }
    Dialog.prototype={
        _init:function () {
            var self = this;
            this.show();
            this.$Dialogbg.click(function () {
                self.hide();
            });
            this.$close.click(function () {
                self.hide();
            });
            this.$btn.click(function () {
                self.hide();
            });
        },
        show:function () {
            this.$Dialogbg.fadeIn(300);
            this.$els.fadeIn(300);
        },
        hide:function () {
            this.$Dialogbg.fadeOut(300);
            this.$els.fadeOut(300);
        }
    };
    
    /*实例化*/
    new Dialog(".Dialogbg",'.DialogBox',{
        close:'.closes',
        btn:'.go-use'
    });

     

  • 相关阅读:
    用VisualSVN做项目版本控制
    jQuery 停止动画
    jQuery 效果
    jQuery 效果
    jQuery 效果
    jQuery 事件
    jQuery 选择器
    jQuery 语法(一)
    Form.ShowWithoutActivation 属性
    C#里面中将字符串转为变量名
  • 原文地址:https://www.cnblogs.com/shimily/p/12058664.html
Copyright © 2011-2022 走看看