<div id="wrap">
<div class="btnArea">
<button type="button" class="arrowTop">
<span class="hidden">상단으로 가기</span>
</button>
</div>
</div>
#wrap{
.btnArea{position: fixed; bottom: 20px; right: 20px;
.arrowTop{width: 45px; height: 45px; border-radius: 50%; background-image: url("../../images/ico/ico-top-button-w.png");
background-repeat: no-repeat; background-position: center; background-color: $_222Bg;}
}
}
#wrap .btnArea {
position: fixed;
bottom: 20px;
right: 20px;
}
#wrap .btnArea .arrowTop {
width: 45px;
height: 45px;
border-radius: 50%;
background-image: url("../../images/ico/ico-top-button-w.png");
background-repeat: no-repeat;
background-position: center;
background-color: #222;
}
$(function(){
$('.arrowTop').on({
"click": function () {
$('#frameBody').animate({ scrollTop: 0 }, 600);
}
});
});
아래 주소를 복사하여 다른 곳에 붙여넣으세요.
모바일 환경에서는 코드 결과가 gif로 표시됩니다.
그래도 결과를 볼까요?
(제대로 된 결과를 보려면 노트북 또는 데스크탑에서 실행해주세요.)