jQuery插件开发模式
来源:互联网 发布:喋血街头java 编辑:程序博客网 时间:2024/05/22 13:20
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<scriptsrc="jquery-1.11.1.min.js"></script>
</head>
<body>
<div id="myDiv">This is a Params JQuery!</div>
<script>
/*
方法列表:
1、jQquery.extend(Object); 是对jQuery类的自定义扩展
2、jQuery.fn.exten(Object);是对jQuery对象的自定义扩展*/
jQuery.fn.test =function(){
alert('这是jquery对象方法!');
}
jQuery('div').click(function(){
$(this).test()
})
jQuery.fn.extend({
test:function(){
return this.each(function(){
alert(this.nodeName)
});
}
});
jQuery('body *').click(function(){
$(this).test()
})
/*优选*/
(function($){
$.fn.hilight=function(options){
var defaults={
foreground:'red',
background:'yellow'
};
var opts =$.extend(defaults,options);
$(this).css('background-color',opts.background);
$(this).css('color',opts.foreground);
};
})(jQuery)
$('#myDiv').hilight({foreground:'blue',background:'red'})
</script>
</body>
</html>
阅读全文
0 0
- jQuery插件开发模式
- jQuery插件开发模式
- jQuery插件开发模式
- jQuery插件开发模式
- jQuery插件开发模式
- jQuery插件开发模式
- jQuery插件开发模式
- jQuery插件开发模式
- jQuery插件开发模式
- jQuery插件开发模式
- jQuery插件开发模式
- jQuery插件开发模式
- jQuery插件开发模式
- jQuery插件开发模式(一)
- jQuery插件开发模式(上)
- jquery插件开发模式(下)
- jQuery插件开发模式详解
- jQuery插件开发基础模式
- OjbectArx cad非模态对话框无法获取焦点
- 《Mesos in Action》一些零碎的笔记(Mesos之于Kubernetes,犹如WebKit之于Chromium)
- 24. Swap Nodes in Pairs
- lua.h源码详解
- loadrunner性能测试_第一步 录制脚本
- jQuery插件开发模式
- jvm常见内存溢出异常
- 数据结构基础加强之二叉树
- 分布式架构学习之:028--ActiveMQ高可用集群(zookeeper+leveldb)安装、配置、高可用测试
- Android 弱引用
- union 与 union all 的区别
- linux系统下安装tomcat
- git创建分支、切换分支
- 关于 Linux windows 平台上的Nginx 403错误