1
두 요소 (# 정보, #content)의 클래스를 제거하고 싶습니다. 창이 50px 스크롤되면. 다음은 클래스를 .active에 추가하고 다시 제거하려는 코드입니다. 슬프게도 작동하지 않습니다. 누군가가 나를 도울 수 있습니까?jQuery - 스크롤에서 클래스 제거
$("#button").click(function(e) {
e.preventDefault();
$("#information, #content").addClass("active");
});
$(window).scroll(function(){
if ((!$(window).scrollTop()>50) || (!$("#information").hasClass("active")))
{
$("#content").removeClass("active");
$("#information").removeClass("active");
}
});
변경''에'($ (창) .scrollTop()> 50) ' – Blazemonger
감사합니다, 그 ($ (창) .scrollTop()> 50!) 공장! – didi
OR 대신 AND를 사용해야합니까? – Aaron