답변 1개 / 댓글 2개
채택된 답변
+20 포인트
style 에서 position과 z-index가 중요하고 bottom과 right 로 위치(아래 예는 우측 하단) 조정 하면 됩니다.
그리고 button 잘보이게 css 먹이시면 되시구요.한번 응용해서보세요.
Copy
<style>
#move_top{position: fixed;bottom: 20px;right: 20px;z-index: 99999;width: 50px;height: 50px;}
</style>
<button type="button" id="move_top">↑</button>
<script>
$("#move_top").on("click", function() {
$("html, body").animate({scrollTop:0}, '300');
return false;
});
</script>
답변을 작성하려면 로그인이 필요합니다.

적용해봤더니 실제 우측하단에 보이긴하는데 이게 사이드바 내에 생기는게 아니네요...
그래서 전체페이지가 이동되고..
사이드메뉴쪽만 상단으로 올리고싶은데 방법이 없을까요?