카테고리 없음
[웹] 당겨서 새로고침(pull to reload) 간단구현(JS, CSS)
toujours_
2020. 9. 12. 21:09
고정위치에있는 객체를 스크롤하여 새로고침하는 경우.
1. '당겨서 새로고침' 문구를 적은 div를 하나 만들고
margin-top 을 height만큼 -로 준다.
2.
$(document).on('touchend',function(){
var top = document.getElementById('refresh').getBoundingClientRect().top; // jquery안먹힘
if (top > 80){
location.href = location.href;
}
}
초 깔끔.
반응형