아래로 스크롤하면 scroll
이벤트가 실행되지 않습니다. 내가 여기서 뭘 잘못하고 있는지 잘 모르겠다.jQuery 스크롤 이벤트가 실행되지 않는 이유는 무엇입니까?
<style>
#scroll {
max-height: 100px;
overflow-y: auto;
width: 647px;
margin: auto;
}
</style>
<body>
<div id='scroll'>
<p>hello world</p>
<p>hello world</p>
<p>hello world</p>
<p>hello world</p>
<p>hello world</p>
<p>hello world</p>
<p>hello world</p>
</div>
<script>
$(document).on("scroll", "#scroll", function() {
console.log("hi");
});
</script>
</body>
당신이 jQuery를 포함했다 당신은 항상 그 이벤트의 발생에 요소에 직접 이벤트 리스너를 추가해야합니까? 확인하는 좋은 방법은 브라우저에서 개발자 도구를 여는 것입니다. – Rohit
'scroll '이 표시됩니까? 나는 그런 작은 내용으로 생각하지 않는다. "scroll"이 나타날 것이다 ... – Rayon
[스크롤을위한 작업을 위임하지 않는 이유는 무엇입니까?] (http://stackoverflow.com/questions/9253904/why-doesnt -delegate-work-for-scroll) –