//this counts how many images exist
var img_count = $("#gallery_scroller img").length;
//this is a number where I want the clicks to stop working
var limit_count = img_count/3;
var click_count = 1;
if (limit_count > click_count){
$("#down_arrow").click(function(){
click_count++
var css_position = -1*click_count*300;
$('#gallery_scroller img').css('top', css_position);
alert(css_position+' '+limit_count+' '+click_count);
});
};
클릭 할 때마다 값을 볼 수 있도록 경고가 표시됩니다. click_count가 limit_count보다 큰 경우에도 계속 진행됩니다. if 조건에서 click_count를 limit_count보다 큰 실제 숫자로 바꿉니다.Javascript if 문이 올바르게 작동하지 않습니다.
이 click_count'이후에 세미콜론을 추가 ++' –