0

以下のコードを使用してjQueryダイアログのタイトルバーの画像を変更しようとしましたが、機能しません。

ダイアログとタイトルバーの画像は次のようになります。

ここに画像の説明を入力してください

$("#dialog").dialog({
    title: '<img src="myImage.jpg" />'
});​​​​​​​​​​​

それを変更する方法について何かアドバイスはありますか?ありがとう

4

2 に答える 2

2

CSS ルールを追加する必要があります。

.ui-dialog-titlebar{
    background:url(http://www.elementalsurface.com/beech-wood.jpg);
}​

デモを見る

于 2012-05-03T12:44:29.517 に答える
1

このコードは、これを行う方法の非常に良いアイデアを提供します。

jQuery:

var $Dialog_div;

function fnOpenDialog() {
    $Dialog_div = $('<div id=\'ThisDialog\'>Hello</div>').prependTo('body');

    $Dialog_div = $('#ThisDialog').dialog({
        autoOpen: true,
        draggable: true,
        resizable: true,
        title: 'Dialogimage<img src="http://dummyimage.com/100x30/000/fff&text=I\'m+an+image,+hi!" />',
        modal: true,
        stack: true,
        height: ($(window).height() * 0.95),
        width: ($(window).width() * 0.9),  
        buttons: {
            'OK': function() {
                $Dialog_div.dialog('close');
            }
        }
    });  
}

$('#ClickMe').click(fnOpenDialog);​

HTML:

<!-- This is more than likely an Adobe issue where it thinks it should be in the front
     all the time no matter what however it is very annoying that you can't open
     a dialog over a PDF-->

<body>
    <div id='ClickMe'>Click here!</div>
    <br/>
    <div></div>
    <br/>      
</body>

(あなたのダイアログのイメージがここのサンプルに非常に似ているのは偶然かもしれません: jQuery ui dialog image for the title :))

作業デモ:

http://jsfiddle.net/V5NkV/またはhttp://jsfiddle.net/V5NkV/10/

上のデモで をクリックするclick meと、小さな画像が入ったダイアログ ウィンドウが表示されます。

よく読んだリンク:

http://jqueryui.com/demos/dialog/

于 2012-05-03T12:29:02.187 に答える