您的位置:首页 > Web前端 > JQuery

Jquery 插件开发

2014-12-11 14:12 246 查看
Jquery 插件开发

;(function ( $, window, document, undefined ){
'use strict';
var pluginName='pluginName';
$.extend({ log: function (logdata) {  console.log(logdata);} });
function Plugin( element, options )
{
$.log(element);$.log(options);
}
$.fn[pluginName] = function ( options ) {
return this.each(function () {
if (!$.data(this, "plugin_" + pluginName)) {
$.data(this, "plugin_" + pluginName, new Plugin( this, options ));
}
});
};
})( jQuery, window, document );


标准插件开发

$.extend  $.fn.extend
<strong>Use:</strong>
$('#div').pluginName({});
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: