0
simple modal과 함께 jQuery 모달의 작동 방식을 이해합니다. 이 모달 창에 (load
에서) 온 외부 파일의 내용을 추가jQuery 모달 내에서 외부 파일의 내용 표시
var load = 'alert.html'; // THE PURPOSE OF THIS QUESTION IS TO CHANGE "alert.html" to "image.jpg"
$(this).click(function(e) {
e.preventDefault();
$('body').append('<div id="overlay" />');
$('#overlay').fadeIn(300, function() {
$('body').append('<div id="alertModalOuter"><div id="alertModal"></div></div>');
var outer = $('#alertModalOuter');
var modal = $('#alertModal');
var defWidth = outer.outerWidth();
var defHeight = outer.outerHeight();
modal.load(load + ' #alert', function() {
var alertBoxContent = $('#alert');
var alertWidth = alertBoxContent.outerWidth();
var alertHeight = alertBoxContent.outerHeight();
var widthCombine = -((defWidth + alertWidth)/2);
var heightCombine = -((defHeight + alertHeight)/2);
modal.animate({width: alertWidth, height: alertHeight}, 200);
outer.animate({marginLeft: widthCombine, marginTop: heightCombine}, 200, function() {
alertBoxContent.fadeIn(200, function() {
});
});
});
이 과정; 하지만 이것은 id = "alert"태그 안의 내용에만 적용됩니다. 외부 파일의 전체 내용을 표시하는 "경고"역할을 제거하려면 어떻게해야합니까? 예를 들어, 외부 이미지 ("alert"태그 사이가 아닌 이미지 파일)를로드하려고합니다.
단순히 modal.load (load, function() {var alertBoxContent = $();'를 사용하여 코드를 수정한다는 의미입니까? 이것은 내가 수행 한 첫 번째 작업이지만 작동하지 않았습니다! – Googlebot