首页 > 其他 > 详细

jq插件封装格式

时间:2019-03-15 16:06:21      阅读:129      评论:0      收藏:0      [点我收藏+]
(function($) {      // closure
    $.fn.hilight = function( options ) {  //将方法定义在$的fn上
        var defaults = {
            textColor: "#000",
            backgroundColor: "#fff"
        };
        var settings = $.extend( {}, defaults, options );
        return this.each(function() {
            // Plugin code would go here...
        });
    };
})(jQuery);

 使用

$(elem).hilight(options)
//或者
$.fn.hilight.call($(elem),options)

 

jq插件封装格式

原文:https://www.cnblogs.com/gopark/p/10537331.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!