1
jQuery-ui 대화 상자의 위치를 변경하는 데 문제가 있습니다.열린 이벤트에서 jquery UI 대화 상자 위치 변경
내가하고있는 일은 열린 이벤트 내의 대화 상자에 이미지를로드하는 것입니다. 알 수없는 이미지 높이 때문에 대화 상자는 더 이상 창 중앙에 있지 않습니다. 그래서 이미지를로드 한 후에도 위치를 재 지정하지만 재배치는 무시되는 것 같습니다.
하지만 재 위치 지정 전에 경고를 추가하면 잘 작동하므로 분명히 일종의 timimg 문제가 여기에 있습니다.
이 문제가 해결 되었습니까?
내 코드의 관련 비트는 다음과 같습니다
$("#dialog-message").dialog({
open: function(e, ui){
var $img = $("#theImage"), mydialog = $(this);
$img.bind('load',function(){ // bind load event
mydialog.dialog("option", "position", {my: "center", at: "center", of: window});
});
$img.attr("src","aRandomImage.jpg"); // start loading
}
: 참조 : IE8에 대한 http://css-tricks.com/snippets/jquery/fixing-load-in-ie-for-cached-images/
이 chached 이미지를
$("#dialog-message").dialog({
open: function(e, ui){
$("#theImage").attr("src","aRandomImage.jpg");
alert(1); // causes the next line to work properly
$(this).dialog("option", "position", {my: "center", at: "center", of: window});
},
...
화려한 - 감사합니다. – Graham
캐시 된 이미지 조심하십시오. 일부 IE 버전은로드 이벤트를 트리거하지 않습니다. 참조 : http://css-tricks.com/snippets/jquery/fixing-load-in-ie-for-cached-images/ –