合并控件扩展方法$.fn.extend写一个即可

This commit is contained in:
Argo-Lenovo 2016-11-03 15:37:47 +08:00
parent 146532f7b9
commit 7a6edef11b
1 changed files with 13 additions and 19 deletions

View File

@ -78,21 +78,6 @@
} }
}); });
$.fn.extend({
"autoCenter": function () {
var that = this;
var getHeight = function () {
return ($(window).height() - $(that).outerHeight()) / 2 + $(document).scrollTop();
}
$(window).resize(function () {
$(that).css({
marginTop: getHeight()
});
});
that.animate({ marginTop: "+=" + getHeight() });
}
});
// enhance window.console.log // enhance window.console.log
if (!window.console) { if (!window.console) {
window.console = { window.console = {
@ -105,6 +90,18 @@
console.log || (console.log = opera.postError); console.log || (console.log = opera.postError);
$.fn.extend({ $.fn.extend({
autoCenter: function () {
var that = this;
var getHeight = function () {
return ($(window).height() - $(that).outerHeight()) / 2 + $(document).scrollTop();
}
$(window).resize(function () {
$(that).css({
marginTop: getHeight()
});
});
that.animate({ marginTop: "+=" + getHeight() });
},
autoValidate: function (options) { autoValidate: function (options) {
// validate // validate
$(this).validate({ $(this).validate({
@ -127,10 +124,7 @@
$(element).popover('show'); $(element).popover('show');
} }
}); });
} },
});
$.fn.extend({
smartTable: function (options) { smartTable: function (options) {
var settings = $.extend({ var settings = $.extend({
method: 'get', //请求方式(* method: 'get', //请求方式(*