码迷,mamicode.com
首页 > Web开发 > 详细

自己用JQueryUI封装了几个系统常用对话框

时间:2015-04-20 11:05:57      阅读:200      评论:0      收藏:0      [点我收藏+]

标签:

/*
 * @功能描述:各种系统消息框
 * @前置插件:JQueryUI
 * @开 发 者:魏巍
 * @开发日期:2015-04-15
 * @version 1.0
 */
var SF = {};
SF.Msg = function () {
    var $msgbox, offTimer;

    var popup = function (_msg) {//自动关闭
        $msgbox = $("<div>" + _msg + "</div>");
        $msgbox.dialog({
            title: "系统提示",
            width: 300,
            height: 150,
            resizable: false,
            close: function () {
                $(this).dialog("destroy");
            }
        });
        $msgbox.prev(‘.ui-dialog-titlebar‘).remove();

        clearTimeout(offTimer);
        offTimer = setTimeout(function () {
            $msgbox.dialog("close");
        }, 1000);
    }

    var succeed = function () {//操作成功
        popup("操作成功");
    }

    var alert = function (_msg) {
        $msgbox = $("<div>" + _msg + "</div>");
        $msgbox.dialog({
            title: "系统提示",
            width: 300,
            height: 200,
            modal: true,
            resizable: false,
            buttons: { "确定": function () { $(this).dialog("close"); } },
            close: function () {
                $(this).dialog("destroy");
            }
        });
    }

    var confirm = function (_msg, _callback) {
        $msgbox = $("<div>" + _msg + "</div>");
        $msgbox.dialog({
            title: "系统提示",
            width: 300,
            height: 200,
            modal: true,
            resizable: false,
            buttons: {
                "确定": function () {
                    $(this).dialog("close");
                    _callback();
                },
                "取消": function () {
                    $(this).dialog("close");
                }
            },
            close: function () {
                $(this).dialog("destroy");
            }
        });
    }

    return {
        popup: popup,
        succeed: succeed,
        alert: alert,
        confirm: confirm
    }
}();

 

自己用JQueryUI封装了几个系统常用对话框

标签:

原文地址:http://www.cnblogs.com/weiweithe/p/4440842.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!