jquery ui Message 簡單使用

tiantangqiu發表於2014-08-12
可以自己在前面加上一張圖片
通過operation判斷 用哪張圖

/**
* @depend jQuery-ui-Dialog
* jQuery ui Dialog
* @author Malt
*/
(function($) {
/**
* @param operation[notice(default)/success/warning/error] image's name
*/
$.simpleMessage = function( message, operation, options ) {
var defaultOptions = {
//position: [objLeft,objTop],
title: "提示",
modal: true,
resizable: false,
minHeight: '25px',
buttons: {
"關閉": function() {
$(this).dialog( "close" );
}
}

};
var imgName = operation || "notice";
var icon = "<img src='jquery/simpleMessage/images/"+imgName+".png' style='float:left;'/>";
defaultOptions.message = '<span style="line-height:30px;font-size:16px;">'+message+'</span>';
defaultOptions = jQuery.extend(defaultOptions, options);
$('<div><center>'+icon + defaultOptions.message +'</center></div>').dialog(defaultOptions);
};

})(jQuery);







$.simpleMessage("hahaah");



[img]http://dl2.iteye.com/upload/attachment/0100/1438/4a3a0f5d-6fa0-37d2-bfec-bbdadfc38454.png[/img]

相關文章