-
[Vue] 페이지 최상단 이동 버튼 만들기Web 2019. 7. 29. 13:48
스크롤을 내렸을때 페이지의 최상단으로 이동할 수 있는 버튼 구현
Code
<v-fab-transition> <v-btn bottom right fixed fab dark small v-show="btnShow" @click="$vuetify.goTo('#header')" > <v-icon>fas fa-angle-double-up</v-icon> </v-btn> </v-fab-transition>
<script> ... methods: { handleScroll() { this.btnShow = window.scrollY > 400; } }, beforeMount() { window.addEventListener("scroll", this.handleScroll); }, beforeDestroy() { window.removeEventListener("scroll", this.handleScroll); } </script>
'Web' 카테고리의 다른 글
AWS with PuTTY (0) 2019.09.05 PWA - Push Notification (0) 2019.08.02 Service Worker (0) 2019.08.01 Firebase deploy (0) 2019.07.30 AWS 배포하기 (0) 2019.07.25