2017/8/13 jq编写插件方法
来源:互联网 发布:mac系统iso镜像下载 编辑:程序博客网 时间:2024/05/22 13:59
// 为 jq 添加 插件
// 注册完毕以后 使用 $("xxx").fun 使用
$.fn.extend({
becomeYellow:function () {
console.log('变黄了哦 嘿嘿嘿');
// 在这个方法中 我们可以使用 $('选择器')获取的 jq对象
// this 就是 我们获取到的jq对象
// 注意 容易 搞混 jq对象 跟dom对象 所以 这里 建议
// 一看到 $_开头的 就知道 是jq对象 防止 跟dom对象弄混
var $_this = this;
$_this.css({backgroundColor:'yellow'});
// jq有一个特点是 链式编程
// 为了能够链式编程 建议 return 当前使用的jq对象
return $_this;
}
});
// 注册完毕以后 使用$.fun 使用
$.extend({
eatFood:function(){
console.log('吃面,不吃蒜,不如来碗饭');
}
})
// 注册完毕以后 使用 $("xxx").fun 使用
$.fn.extend({
becomeYellow:function () {
console.log('变黄了哦 嘿嘿嘿');
// 在这个方法中 我们可以使用 $('选择器')获取的 jq对象
// this 就是 我们获取到的jq对象
// 注意 容易 搞混 jq对象 跟dom对象 所以 这里 建议
// 一看到 $_开头的 就知道 是jq对象 防止 跟dom对象弄混
var $_this = this;
$_this.css({backgroundColor:'yellow'});
// jq有一个特点是 链式编程
// 为了能够链式编程 建议 return 当前使用的jq对象
return $_this;
}
});
// 注册完毕以后 使用$.fun 使用
$.extend({
eatFood:function(){
console.log('吃面,不吃蒜,不如来碗饭');
}
})
阅读全文
0 0
- 2017/8/13 jq编写插件方法
- jq插件的编写方法(自定义jq插件)
- jq 插件编写 待
- jQ 编写插件
- jq编写轮播插件
- 实战编写jq插件轮播图
- 【前端】jq插件的编写
- JQ插件写法 扩展JQ方法
- [jq] 最终确定的jq插件结构编写
- jquery插件编写方法
- JQuery插件编写方法
- JQ插件
- jq插件
- jQuery插件的编写方法
- jQuery插件的编写方法
- 分享一个制作JQ插件方法的文章
- jq插件 datatable的使用(附上window一些方法)
- jq插件的编写中(jquery.extend、jquery.fn与jquery.fn.extend的使用区别)
- 网络编程第一步:时间戳----python3
- 开发java web报错:The origin server did not find a current representation for the target resource or is n
- python基础-时间日期处理小结
- poj-青蛙的约会
- 用JTAG将mcs文件烧写到flash中
- 2017/8/13 jq编写插件方法
- 使用RTSP判断摄像机设备是否在线以及快照抓取
- C++笔试题 String类的实现
- JNI调用里面的多线程
- [Codeforces Round #428 DIV2E (CF839E)] Mother of Dragons
- 设计模式之外观模式
- 【原】使用Bmob作为iOS后台开发心得——查询关联关系(BmobRelation)
- UVA 147 Dollars(完全背包)
- 网易2018校招编程题集合7