欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

lhgdialog弹窗插件 气泡提示

程序员文章站 2023-12-28 21:49:04
...

跨平台兼容特性

兼容:IE6+、Firefox、Chrome、Safari、Opera以及iPad等移动设备。并且IE6下也能支持现代浏览器的静止定位(fixed)、覆盖下拉控件、alpha通道png背景。


function confirmDel(oid) {//多个参数
    dialog_confirm_callBack('确定要取消吗', orderCallback, {orderId: oid});
}

function orderCallback(data) {
    $.ajax({
        type: "get",
        url: "<?php echo $this->createUrl('/pc/ajax/orders')?>",
        data: {id: data.orderId, op: 'cancel'},
        dataType: "json",
        success: function (msg) {
            dialogObj.content('取消订单成功!');
            window.location.reload();
        }
    })
}
var api = frameElement.api, W = api.opener;
$.dialog({
    title: '客户退回',
    content: 'url: ' + winurls,
    id: 'WinMessage',
    ok: function () { //点击按钮调用子窗口的方法
        result = this.iframe.contentWindow.submitForm();
    }
});
api.get('KDf435').content('对话框内容被扩展方法改变了').close();
api.get('demo_ZB').document.getElementById('zone_id').value;
// api.get('demo_ZB') 返回的是id为'demo_ZB'的B窗口的内容页的window对象
function reloadB()
{
    if( !api.get('demo_ZB') || !api.get('demo_ZB') )
	    alert( '请先打开B窗口' );
	else
	    api.reload( api.get('demo_ZB') );
}

//刷新当前窗口指定链接,并遮罩
api.reload(window, '/index.html');api.lock();
皮肤设置
<script type="text/javascript" src="lhgdialog.min.js?skin=chrome"></script>
 lhgdialog可以直接传url
function dialog_confirm_callBack(content, okCallBack, opts) {
    var setting = $.extend({width: 300, height: 300, okBtnLabel: '确定', cancelBtnLabel: '取消', title:'系统消息'}, opts);

    var dialogObj = $.dialog({
        id: 'win_confirm',
        fixed: true,
        title: setting.title,
        width: setting.width,
        height: setting.height,
        content: content,
        okVal: setting.okBtnLabel,
        ok: function () {
            delete setting.width;
            delete setting.height;
            delete setting.okBtnLabel;
            delete setting.cancelBtnLabel;
            delete setting.title;

            okCallBack.apply(this, [setting]);
            return false;
        },
        cancelVal: setting.cancelBtnLabel
    });
}

/**
 *  系统右下角消息,3秒内关闭
 * @param content 内容
 */
function dialog_system_msg(content) {
    $.dialog({
        id: 'msg',
        title: '系统消息',
        content: content,
        width: 200,
        height: 100,
        time: 3,
        left: '100%',
        top: '100%',
        fixed: true,
        drag: false,
        resize: false
    });
}
/**
 * 提示 跳转新的网址
 *
 * @param url 新的跳转网址
 * @param txt 内容
 */
function dialog_confirm(url, txt) {
    $.dialog({id:"dialog_confirm", content: txt, icon: "warning", lock: "true", ok: function () {
        location.href = url;
    }});
}

/**
 * 提问消息[prompt]显示对话框
 *
 * @param url 地址
 * @param title 标题
 * @param inputId 接收值的元素ID
 */
function dialog_prompt(txt, defaultVal, inputId) {
    if (txt == undefined) txt = "";
    if (defaultVal == undefined) defaultVal = "";
    $.dialog.prompt(txt, function (data) {
        if (inputId != undefined) {
            $("#inputId").val(data);
        }
    }, defaultVal);
}
/**
 * alert 警告消息 提示 3s 关
 * lock 锁屏
 *
 * @param txt 内容
 */
function dialog_alert(txt) {
    $.dialog({id:"msg", time: 3, content: txt, lock: true, icon: "warning", title: "提示消息"});
}

/**
 * 提示消息[tips]
 * 1.5秒自动关闭
 * @param txt 提示内容
 */
function dialog_tips(txt) {
    $.dialog.tips(txt, 1.5);
}

/**
 * open IFrame 打开指定连接的对话框
 * lock 锁屏
 * @param url 地址
 */
function dialog_open(url, opts) {
    var setting = $.extend({width: '500px', height: '460px', title: ''}, opts || {});
    $.dialog({id:"dialog_win", title: setting.title, content: "url:" + url, height: setting.height, width: setting.width, lock: false,ok: function () {
        this.hide();
        return false;
    }});
}
function dialog_image(url, opts) {
    var setting = $.extend({width: '500', height: '460', title: ''}, opts || {});
    $.dialog({
        id: 'image_win',
        title: setting.title,
        lock: true,
        content: '<img src="' + url + '" width="' + setting.width + '" height="' + setting.height + '"/>',
        padding: 0
    });
}
 

上一篇:

下一篇: