/**
* 插件的学习
* 原文地址:http://www.cnblogs.com/Wayou/p/jquery_plugin_tutorial.html#home
*/

;(function($, window, document,undefined) {
    //定义Beautifier的构造函数
    var Beautifier = function(ele, opt) {
        this.$element = ele,
        this.defaults = {
            'color': 'red',
            'fontSize': '12px',
            'textDecoration': 'none'
        },
        this.options = $.extend({}, this.defaults, opt)
    }
    //定义Beautifier的方法
    Beautifier.prototype = {
        beautify: function() {
            return this.$element.css({
                'color': this.options.color,
                'fontSize': this.options.fontSize,
                'textDecoration': this.options.textDecoration
            });
        }
    }
    //在插件中使用Beautifier对象
    $.fn.myPlugin = function(options) {
        //创建Beautifier的实体
        var beautifier = new Beautifier(this, options);
        //调用其方法
        return beautifier.beautify();
    }
})(jQuery, window, document);

最新文章

  1. Python之路-python数据类型(列表、字典、字符串、元祖)操作
  2. UESTC 900 方老师炸弹 --Tarjan求割点及删点后连通分量数
  3. 字符串去掉空格 trim()方法
  4. 小白日记34:kali渗透测试之Web渗透-扫描工具-Burpsuite(二)
  5. 也用 Log4Net 之将日志记录到数据库的配置 (一)
  6. 如何在 Linux 终端下创建新的文件系统/分区
  7. 【转】web开发需要知道的事情
  8. CString常用操作
  9. Redis操作命令大全(NodeJS版)
  10. SQL XML process
  11. Android 蓝牙开发(整理大全)
  12. javascript 动态创建tip图片提示
  13. 部署openstack的官网文档解读mysql的配置文件
  14. 登陆页、注册页、会员中心页logo图的替换
  15. JavaScript-DOM(2)
  16. python---面对对象的三大特征
  17. 【紫书】Ordering Tasks UVA - 10305 拓扑排序:dfs到底再输出。
  18. Nginx 连接限制和访问控制Nginx 连接限制和访问控制
  19. 主成分分析(PCA)算法,K-L变换 角度
  20. maven 安装下载与配置 代理设置 《解决下载慢问题》

热门文章

  1. POJ 3621Sightseeing Cows
  2. C++库研究笔记——生成一组随机数
  3. 在HTTP响应标题中隐藏ASP.NET MVC的版本
  4. PowerShell运行cmd命令
  5. 开发XMPP IM
  6. 谈谈Javascript线程
  7. 并发与多版本:update重启动问题
  8. ubuntu系统安装redis
  9. VC++ Bresenham画线实例
  10. PostgreSQL 修改列报错:cannot be cast automatically to type integer