簡體   English   中英

jQuery對話框在文本框旁邊的位置

[英]JQuery Dialog position beside text box

我有一個html文本框,當我單擊“時間”類型的文本框時,希望在其旁邊顯示一個jquery對話框。 例如:

我想要的是

到目前為止,我有:

HTML:
Time <input id="theTime" class="time" name="inputTime" type="text">

JQuery的:

$(".time").click(function(e) {      
    $( "#dialog-message" ).dialog({
    modal: false,
    buttons: {
        Ok: function() {
        $( this ).dialog( "close" );
        }
    },
    position: $(this).position()
    });

    $("#dialog-message").dialog("open");
});

上面的代碼位置錯誤。 我的對話框沒有顯示在正確的位置。 如何使其像圖片一樣顯示在文本框的右側?

使對話消息絕對定位,

$("#dialog-message").css("position","absolute")

這似乎有效! position: { my: "left bottom", at: "right bottom", of: $(this) }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM