要学会做自己的jQuery插件
一.全局jQuery函数扩展方法
$.log =
function(){}
方法是:$.方法名 = function(){}
$.ww =
function(){
console.log(
"雯雯")
};
效果: 二.普通的jQuery实例对象 扩展一个普通的jQuery对象的方法
$.fn.www =
function(){
console.log($(
this).text());
};
$(
function(){
$(
'div').www();
})
自己写插件。后面多次调用,组件化
转载请注明原文地址: https://www.6miu.com/read-1700269.html