너무 간단하지만, 쓸 일이 많으므로 저장!


최상단으로 가는 버튼

 

html

<button type="button" id="goTop'"> go to ther TOP </button>

jQuery

$('#goTop').on('click', function(e){ 
     $("html, body").animate({ scrollTop : 0 }, "400") ;
     return false; 
});

최하단으로 가는 버튼

html

<button type="button" id="goBottom"> go to ther BOTTOM </button>

 

jQuery

$('#goBottom').on('click', function(e){ 
     $("html, body").animate({scrollTop : $(document).height() }, "400");
     return false; 
})

'Frontend' 카테고리의 다른 글

NUXT.js 로 Vue SSR 세팅하기(1)  (0) 2019.06.23
아코디언 메뉴(업데이트 예정)  (0) 2019.04.12
jQuery를 pure js, vue.js로 바꿔보자  (0) 2019.02.25
뷰 설치  (0) 2019.02.12
[Array] array.filter 메서드 사용하기  (0) 2019.01.29

+ Recent posts