두 개의 클릭 기능이 설정되어 있으며 첫 번째 기능을 사용하면 .test
div 를 클릭하고 스크롤 할 수 있습니다 . 이 후에 .test:last-child
는 red
클래스 를 제거하고 클래스를 추가 한 blue
다음 blue
클래스 div에서 클릭 함수를 실행 하고 숨 깁니다. 유일한 문제는 .blue
div 의 클릭 기능을 인식하지 못하는 것 같고 작동하지 않는다는 것 입니다.
jsFiddle 데모 : http://jsfiddle.net/neal_fletcher/adMYV/1/
HTML :
<div class="test red"></div>
<div class="test red"></div>
<div class="test red"></div>
<div class="test red"></div>
<div class="test red"></div>
jQuery :
$(document).ready(function () {
$(".red").click(function () {
var next;
next = $(this).nextAll(".test");
$('html, body').animate({
scrollTop: next.offset().top
}, "slow");
return false;
});
});
$(document).ready(function () {
$('.test:last-child').removeClass('red').addClass('blue');
$('.blue').click(function () {
$(this).hide();
return false;
});
});
어떤 제안이라도 대단히 감사하겠습니다!
다음과 같이 시도하십시오.
암호
$(document).on("click", ".blue", function () {
$(this).hide();
return false;
});
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다