3

我想删除 jQuery UI 中的对话框标题并添加我的关闭按钮。关闭按钮是图像,当用户单击图像时,对话框将被关闭。这是我的片段:

$("#dialog-model").dialog({
    create: function (event, ui) {
        jQuery(".ui-dialog-titlebar").hide();
        $("#dialog-model").css({ 'font-family': 'Helvetica', 'padding': '0', 'font-size': '12px' });
    },
    height: 500,
    width: 900,
    modal: true,

});

我尝试在 scipt 中添加图像,但它不起作用

4

1 回答 1

3

更新答案

试试这个?演示http://jsfiddle.net/yeyene/GnpQ8/2/

创建一个自定义关闭按钮。

$(document).ready(function(){
    $("#dialog-model").dialog({
        create: function (event, ui) {
            $('.ui-dialog-titlebar').css({'background':'none','border':'none'});
            $(".ui-dialog-titlebar").html('<a href="#" role="button"><span class="myCloseIcon">close</span></a>');
            $("#dialog-model").css({ 'font-family': 'Helvetica', 'padding': '0', 'font-size': '12px' });
        },
        width: 250,
        height: 150,       
        modal: true,
        resizable: false
    });
    
    $("span.myCloseIcon").click(function() {
        $( "#dialog-model" ).dialog( "close" );
    });
});    
于 2013-06-17T02:18:21.837 回答