내 갤러리 페이지에 두 개의 함수를 배포합니다. 하나는 이미지와 함께 목록 항목을 표시하고 다른 하나는 이미지 (외부)가로드되지 않는 항목을 확인 및 제거합니다.재귀 jquery 함수 및 이후에 확인
첫 번째 작품은 훌륭하지만 두 번째 작품은 그렇지 않습니다. 이유를 알아낼 수 없습니다. 아무도 이걸 아나요?
var r = 0,
selector = "ul.display li:hidden:first";
function fadeIn($item) {
$item.fadeIn(200, function() {
var n = $(selector);
if (n.length > 0) {
fadeIn($(selector));
} else {
// add a div
$(".navigate").show("fast");
$("#downunder").show("slow");
}
})
}
fadeIn($(selector));
function myFunc() {
$("ul.display li img").each(function(index) {
if ((!this.width || !this.height)) {
pos3 = $(this).attr("id");
reportrefcam();
$(this).parent().parent().remove();
}
$(this).error(function() {
pos3 = $(this).attr("id");
reportrefcam();
$(this).parent().parent().remove();
});
});
};
myFunc();
왜 함수에 변수를 넣고 있습니까? 'function myFunc() {'할 것이다. – Lg102
코드가 제대로 들여 쓰기되면 ** 로트 ** 읽기 쉽고 디버그하기가 쉽습니다. 당신의'myFunc' 코드 들여 쓰기가 여기 저기에 있습니다. –
TJ : 좀 더 읽기 쉽도록 마크 업을 만들었습니다 – mark