jQuery写组件适当暴露
来源:互联网 发布:易语言英语考试软件 编辑:程序博客网 时间:2024/06/04 19:27
//适当暴露一些默认设置
(function($){
$.fn.hilight = function(options){
var opts = $.extend({},$.fn.hilight.defaults,options);
var $this = $(this);
$this.css(opts);
}
$.fn.hilight.defaults = {
foreground : 'red',
background : 'blue'
}
})(jQuery),function(e){
e.fn.testHilight = function(options){
var defaults = {
foreground : 'red',
background : 'yellow'}
var opts = $.extend({},defaults,options);
var $this = $(this);
$this.css(opts);
}
}(jQuery),function(f){
f.fn.testAnotherHilight = function(options){
var defaults = {
foreground : 'red',
background : 'gray'}
var opts = $.extend({},defaults,options);
var $this = $(this);
$this.css(opts);
}
}(jQuery),function(a){
//适当暴露写函数
a.fn.hilightFormat = function(){
return this.each(function(){
var $this = $(this);
var thisHtml = $this.html();
var formatHtml = a.fn.hilightFormat.format(thisHtml);
$this.html(formatHtml);
});
}
a.fn.hilightFormat.format = function(txt){
return "<strong>" + txt + "<//strong>";
}
}(jQuery)
$(function(){
$.fn.hilight.defaults = {background : 'black'};
//$("#test").hilight();
$(".hilightFormat > p").hilightFormat();
console.log($(".test").metadata().some);
});
(function($){
$.fn.hilight = function(options){
var opts = $.extend({},$.fn.hilight.defaults,options);
var $this = $(this);
$this.css(opts);
}
$.fn.hilight.defaults = {
foreground : 'red',
background : 'blue'
}
})(jQuery),function(e){
e.fn.testHilight = function(options){
var defaults = {
foreground : 'red',
background : 'yellow'}
var opts = $.extend({},defaults,options);
var $this = $(this);
$this.css(opts);
}
}(jQuery),function(f){
f.fn.testAnotherHilight = function(options){
var defaults = {
foreground : 'red',
background : 'gray'}
var opts = $.extend({},defaults,options);
var $this = $(this);
$this.css(opts);
}
}(jQuery),function(a){
//适当暴露写函数
a.fn.hilightFormat = function(){
return this.each(function(){
var $this = $(this);
var thisHtml = $this.html();
var formatHtml = a.fn.hilightFormat.format(thisHtml);
$this.html(formatHtml);
});
}
a.fn.hilightFormat.format = function(txt){
return "<strong>" + txt + "<//strong>";
}
}(jQuery)
$(function(){
$.fn.hilight.defaults = {background : 'black'};
//$("#test").hilight();
$(".hilightFormat > p").hilightFormat();
console.log($(".test").metadata().some);
});
0 0
- jQuery写组件适当暴露
- 第一次写jquery组件
- jquery 写的分页组件
- 写代码时适当休息的必要性
- Android静态安全检测 -> Activity组件暴露
- Android静态安全检测 -> Service组件暴露
- 呈上一个近期用jquery写的jDialog组件
- 用jQuery写个简单的日历组件
- 【积淀】jQuery写个简单的模态窗口组件
- 为什么Blog应适当地写感受和评论
- 将 dotNET组件暴露给COM (上)
- 将 dotNET组件暴露给COM (下)
- 是否可以不暴露组件的类型库信息?
- Android静态安全检测 -> Content Provider组件暴露
- Android静态安全检测 -> Broadcast Receiver组件暴露
- jquery 组件
- UI组件:暴露最小限度接口,在组件基类中实装共性属性
- 自己写的jquery组件,本地显示系统时间,可以随时更改时间
- 用TorToiseGit来管理github上的项目
- C++ 结构体/枚举总结
- 基于文件列表批量拷贝文件
- uboot学习
- The 'Microsoft.ACE.Oledb.12.0' provider is not registered on the local machine
- jQuery写组件适当暴露
- xcode 证书清理
- 从太极助手事件看移动应用市场
- Chromium源码获取与编译--附加一个简单例子的编译
- C++通过虚函数表调用虚函数
- resolveUri failed on bad bitmap uri: android.graphics.Bitmap@40527328解决方法
- 最长公共子序列LCS
- ns16550串口驱动
- 他从滴水洞中走来(其一,二)