jquery自定义函数
来源:互联网 发布:java图书管理系统代码 编辑:程序博客网 时间:2024/06/06 01:45
*jquery 的拓展方法
*/
/**
* 给btn 添加去除disabled
*/
$.fn.disabled = function() {
$(this).each(function(index,em){
var _this = $(em);
if(_this.is('button')||_this.is('input[type="button"]')){
_this.prop('disabled','disabled');
_this.css('cursor','not-allowed');
_this.removeClass('u-btnBlue');
_this.css({'background': '#1f5183','color': '#fff'});
}else if (_this.is('input')) {
_this.prop('disabled','disabled');
}else if (_this.is('.u-btn')) {
_this.addClass('u-btnDisable');
var _width = _this.outerWidth();
var _height = _this.outerHeight();
var _zIndex = _this.css("z-index");
console.log(parseFloat(_zIndex));
_this.css('position','relative');
var mark = $("<div class='mark'></div>").css({"z-index":_zIndex+1,"width":_width,"height":_height,"opacity":0.5,"top":0,"left":0,"position":"absolute","background-color":"transparent"});
_this.append(mark);
mark.click(function(){
return false;
});
};
});
};
Number.prototype.formatMoney = function(places, symbol, thousand, decimal) {
places = places || 0;
places = !isNaN( places = Math.abs(places)) ? places : 2;
symbol = symbol !== undefined ? symbol : "";
thousand = thousand || ",";
decimal = decimal || ".";
var number = this,negative = number < 0 ? "-" : "", i = parseInt( number = Math.abs(+number || 0).toFixed(places), 10) + "", j = ( j = i.length) > 3 ? j % 3 : 0;
number = symbol + negative + ( j ? i.substr(0, j) + thousand : "") + i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + thousand) + ( places ? decimal + Math.abs(number - i).toFixed(places).slice(2) : "");
return number == 0?0:number;
};
/**
* 格式化后转number字符串
* @param {Object} symbol 货币标识
* @param {Object} thousand 分隔符
* @param {Object} decimal 小数点符号
*/
String.prototype.formatMoneyToNumber = function(symbol, thousand, decimal) {
var string = this;
string = string || '0';
symbol = symbol || "";
symbol = symbol !== undefined ? symbol : "";
thousand = thousand || ",";
decimal = decimal || ".";
return string.replace(symbol, '').replace(new RegExp(thousand,"g"), '').replace(decimal, '.');
};
- jQuery 自定义函数方法
- Jquery自定义函数
- JQUERY自定义动画函数
- jquery自定义函数
- jquery自定义函数方法
- jquery自定义函数方法 .
- jQuery自定义函数
- jQuery 调用自定义函数
- jquery 自定义函数
- jquery自定义函数
- JQUERY自定义动画函数
- jquery自定义函数调用
- jquery 自定义函数
- jQuery自定义函数
- jquery调用自定义函数
- 自定义jquery函数
- jQuery自定义函数
- jQuery自定义函数
- 第一篇博客
- Python+eclipse+pydev 环境搭建
- GPUImage渲染原理之OpenGL理解
- Hadoop中mapReduce处理过程详解
- C++编译出现binding ‘const string {aka const std::__cxx11::basic_string<char>}’ to reference of type ‘std
- jquery自定义函数
- embedded tomcat
- java-ajax使用方法(异部请求)
- 最近公共祖先(LCA)的三种求解方法
- RocketMQ 客户端公共配置文件ClientConfig解读
- group by
- 总结mysql数据库中InnoDB与Myisam表类型的的六大区别
- mybatis + postgresql
- freeradius