3
내가 뭘하려고하는지 아약스를 통해 두 개의 동시 이미지로드가 완료되면 어떤 일이 발생합니다. 이렇게하려면 이미지로드가 완료 될 때 해결할 사용자 지정 지연을 만들었습니다.
<div id="i"></div>
$(document).ready(function() {
$('#i').hide();
var imgLoad = loadImgs();
$.when(imgLoad).then(function() {
$('#i').show('slow');
});
});
function loadImgs() {
var dfd = $.Deferred();
var matrix = $.getJSON("https://graph.facebook.com/thematrixmovie");
var pulp = $.getJSON("https://graph.facebook.com/pulpfiction");
$.when(matrix, pulp).then(function(m, p) {
mImg = '<img src=' + m[0].picture + '>';
pImg = '<img src=' + p[0].picture + '>';
$('#i').show().append(mImg + pImg);
dfd.resolve;
});
return dfd.promise();
}
이 on JSFiddle을 시도 할 수 있습니다.
저는 working example을 포함하여 Eric Hynds post을 참고로 사용했지만 여전히 작동하지 않았습니다. 어떤 아이디어?