[ jQuery ] jquery 自定义插件!
来源:互联网 发布:白云先生新浪博客知乎 编辑:程序博客网 时间:2024/05/01 11:28
转载请自觉注明原文:http://www.jq-school.com/Show.aspx?id=169
jquery学堂是一个很不错的地方。
如果想要自己学一些jquery的插件。而不想去每次都写那些复杂的函数。那么下面的方法可以帮助你。
下面就自己写一个jquery.yangzhi.js.
$(function(){$.fn.yangzhi = function(options){var defaults = {Event:"click",msg:"Hello,world"};var options = $.extend(defaults,options);var $this = $(this);$this.live(options.Event,function(e){alert(options.msg);});}});
然后在html页面中调用就可以了。这里的一些属性都是用配置来解决的。
html页面如下:
<html><head><title>jquery.yangzhi.js test</title></head><script src = "jquery-1.7.2.js" type = "text/javascript"></script><script src = "jquery.yangzhi.js" type = "text/javascript"></script><script type = "text/javascript">$(function(){$("#test").yangzhi({Event:"click",msg:"so easy"});});</script><body><input type = "button" value = "login" id = "test"/></body></html>
- [ jQuery ] jquery 自定义插件!
- 【jQuery】jQuery自定义插件开发
- jquery 自定义插件开发
- 自定义jQuery插件
- jquery自定义插件
- jQuery 自定义插件
- jquery 自定义插件开发
- jquery自定义插件
- jquery 自定义插件小结
- Jquery自定义插件
- jQuery自定义插件
- jQuery自定义插件
- JQuery扩展自定义插件
- jQuery自定义插件
- jQuery 自定义插件
- jQuery--自定义插件
- jQuery自定义插件
- jquery自定义插件
- 各种数据库连接方法
- adbpush.bat (window batch file)
- Window下Qt中用qDebug()输出调试信息到Console控制台的设置方法
- Proxy学习
- android开发控件——progressbar(入门)
- [ jQuery ] jquery 自定义插件!
- 惠州市惠阳区房价偏低的原因深入分析
- [ jQuery ] jQuery 基础使用!
- NIO:为什么需要 NIO?
- Linux mount命令的使用方法
- UML总结——系统静态图
- 编译chrome
- NIO:与 Buffer 一起使用 Channel
- 哈夫曼建树、编码、解码加强版