zoukankan      html  css  js  c++  java
  • 今天写的小插件

    在修改一下,暂时这样

    ;(function($, window, document, undefined){
        var tiance = function(element, opt){
            this.element = element; 
            this.defaults = {
                'str':'<p class="ceshi">×</p>',
                'close':'.ceshi',
                'closeCss':{'position':'absolute','left':0,'top':0,'width':'100%', 'height':'100%'}    
            },
            this.options = $.extend({}, this.defaults, opt);
        }
        tiance.prototype = {
            'repeal' : function(){
                    var _this = this;
                    return this.element.each(function(index, item){
                        $(item).css('position','relative').append(_this.options.str);
                        $(_this.options.close).css(_this.options.closeCss).each(function(index, select){
                            $(select).on('click',function(ev){
                                _this.options.func($(this).closest($(item)),$(this));
                        })
                    })
                })
            }
        }
        $.fn.myPlugin = function (options){
             var tiance1 = new tiance(this, options);
             return  tiance1.repeal();
        }
    })(jQuery, window, document);
  • 相关阅读:
    python while 格式化 运算符 编码
    python 变量 if
    1、cad安装
    10、云存储—文件上传
    9、云函数
    8、云数据库
    8、小程序云开发
    7、页面交互js
    6、页面样式WXSS
    5、页面结构WXML
  • 原文地址:https://www.cnblogs.com/clearfix/p/4167185.html
Copyright © 2011-2022 走看看