아주 간단한 소스
See the Pen Untitled by publisher.kim (@publisherkim) on CodePen.
html
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<!-- 스크롤 박스 -->
<div class="container">
<!-- 스크롤 컨텐츠 -->
<div class="content">
컨텐츠
</div>
</div>
css
.container{border:1px solid #ddd; height:300px; overflow-y:auto; box-sizing:border-box; padding:20px;}
.content{height:500px; background:#777; color:#fff;}
js *jquery필요
$(document).ready(function () {
$(".container").scroll(function(){
var containerSctop = $(".container").scrollTop();
var containerHeight = $(".container").height();
var contentHeight = $('.content').height();
if(containerSctop + containerHeight >= contentHeight-1) {
alert("스크롤 끝까지 내림")
}else{
}
})
})
728x90
'퍼블리싱 > HTML | CSS | Javascript' 카테고리의 다른 글
input text with animation label (0) | 2023.09.15 |
---|---|
css 가상요소에 content로 텍스트 넣을때 br 처리 (0) | 2023.09.06 |
버튼 클릭시 input 값이 증감되는 소스 (0) | 2023.08.29 |
swiper slider with background scale animation (0) | 2023.07.12 |
랜덤으로 순서가 바뀌는 slider (+with video), 플러그인 x (0) | 2023.07.12 |