이것은 이상하지만 어쩌면 간단합니다.JQuery 조건부 작업이 잘못되었습니다.
가장 간단한 숫자를 확인하려면 간단한 작업을 수행하고 있습니다. 디버그 문을 가지고 있는데 JQuery가 10을 반환한다는 것을 보여줍니다. < 2입니다. 그것은 10
제발 도와주세요 어떤 것보다 작다는 것을 말한다 (10)에 도달 할 때마다
"Tip id = 2" lightbox.js:6
"2<50" lightbox.js:8
"Tip id = 3" lightbox.js:6
"Tip id = 4" lightbox.js:6
"Tip id = 5" lightbox.js:6
"Tip id = 6" lightbox.js:6
"Tip id = 7" lightbox.js:6
"Tip id = 8" lightbox.js:6
"Tip id = 9" lightbox.js:6
"Tip id = 10" lightbox.js:6
"10<2" lightbox.js:8
"Tip id = 11" lightbox.js:6
"Tip id = 12" lightbox.js:6
"Tip id = 13" lightbox.js:6
"Tip id = 14" lightbox.js:6
"Tip id = 15"
어떤 이유 :
var lowID = 50;
$('.tip').each(function() {
console.log('Tip id = ' + this.id);
if(this.id < lowID){
console.log(this.id + '<' + lowID);
lowID = this.id;
}
});
그리고 여기 디버깅 : 여기
코드입니다 이것은 잠시 동안 보아도 가장 이상한 문제 일 수 있습니다.
을 사용하는 것입니다 – MarshallOfSound
@MarshallOfSound 감사합니다. 위 코드를 수정했습니다. –
상단에서 null과 같게 설정하는 점은 무엇입니까? – MarshallOfSound