簡體   English   中英

jQuery UI對話框未定位

[英]Jquery UI Dialog box not positioning

因此,我在jquery ui網站和其他類似的stackoverflow問題上一直呆滯/困惑。 無論我輸入什么內容,無論何時我輸入代碼,我的對話框都只會默認顯示在中心位置,而其他人似乎已經在此處進行了修復,導致我的對話框停止工作。

我的html:

<div id = "dialog-3"
     title = "How is this data aquired?">Any crime publically reported by a local police department is gathered and shown on the map!</div>

我的JS:

$( "#dialog-3" ).dialog({
           autoOpen: true, 
           hide: "explode",
           height: 80
        });
$("#dialog-3").dialog(option, position) [25,25];
     });

預先謝謝您,我是編碼的新手,如果這是一個愚蠢的修復程序,請對不起。

根據文檔

默認值:{my:“ center”,位於:“ center”,of:window}

您實際上並沒有設置位置,因此它正在顯示默認行為。 為了解決這個問題,請在您的getter或setter中, 相對於傳統定位的元素設置位置。

$( "#dialog-3" ).dialog({
       autoOpen: true, 
       hide: "explode",
       height: 80,
       position: {
         my: "left top",
         at: "left+25 bottom+25",
         of: "#positioned-div"
       }
});

$("#dialog-3").dialog("option", "position");

-要么-

$( "#dialog-3" ).dialog({
       autoOpen: true, 
       hide: "explode",
       height: 80
});

$("#dialog-3").dialog("option", "position", {
         my: "left top",
         at: "left+25 bottom+25",
         of: "#positioned-div"
});

祝您好運,編碼愉快!

暫無
暫無

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

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