맨위로 가는 버튼
This commit is contained in:
parent
bd58503912
commit
c0ea8469db
@ -433,3 +433,28 @@ cursor: not-allowed !important;
|
|||||||
scrollbar-width: none;
|
scrollbar-width: none;
|
||||||
}
|
}
|
||||||
/* commuters project list end */
|
/* commuters project list end */
|
||||||
|
|
||||||
|
/* Scroll Button */
|
||||||
|
|
||||||
|
.scroll-top-btn {
|
||||||
|
bottom: 20px;
|
||||||
|
right: 20px;
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
transform: translateY(10px);
|
||||||
|
transition: opacity 0.4s ease, visibility 0.4s ease, transform 0.4s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll-top-btn.visible {
|
||||||
|
opacity: 1;
|
||||||
|
visibility: visible;
|
||||||
|
transform: translateY(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.scroll-top-btn.hidden {
|
||||||
|
opacity: 0;
|
||||||
|
visibility: hidden;
|
||||||
|
transform: translateY(10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Scroll Button end */
|
||||||
32
src/components/button/ScrollTopButton.vue
Normal file
32
src/components/button/ScrollTopButton.vue
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<template>
|
||||||
|
<button
|
||||||
|
@click="scrollToTop"
|
||||||
|
class="scroll-top-btn rounded-pill btn-icon btn-primary position-fixed shadow z-5 border-0"
|
||||||
|
:class="{ 'visible': showButton, 'hidden': !showButton }"
|
||||||
|
>
|
||||||
|
<i class='bx bx-chevron-up'></i>
|
||||||
|
</button>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup>
|
||||||
|
import { ref, onMounted, onUnmounted } from "vue";
|
||||||
|
|
||||||
|
const showButton = ref(false);
|
||||||
|
|
||||||
|
const handleScroll = () => {
|
||||||
|
showButton.value = window.scrollY > 200;
|
||||||
|
};
|
||||||
|
|
||||||
|
const scrollToTop = () => {
|
||||||
|
window.scrollTo({ top: 0, behavior: "smooth" });
|
||||||
|
};
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
window.addEventListener("scroll", handleScroll);
|
||||||
|
});
|
||||||
|
|
||||||
|
onUnmounted(() => {
|
||||||
|
window.removeEventListener("scroll", handleScroll);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
@ -23,6 +23,8 @@
|
|||||||
|
|
||||||
<!-- Drag Target Area To SlideIn Menu On Small Screens -->
|
<!-- Drag Target Area To SlideIn Menu On Small Screens -->
|
||||||
<div class="drag-target"></div>
|
<div class="drag-target"></div>
|
||||||
|
|
||||||
|
<ScrollTopButton />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script setup>
|
<script setup>
|
||||||
@ -32,6 +34,7 @@
|
|||||||
import TheChat from './TheChat.vue';
|
import TheChat from './TheChat.vue';
|
||||||
import { nextTick } from 'vue';
|
import { nextTick } from 'vue';
|
||||||
import { wait } from '@/common/utils';
|
import { wait } from '@/common/utils';
|
||||||
|
import ScrollTopButton from '@c/button/ScrollTopButton.vue';
|
||||||
|
|
||||||
window.isDarkStyle = window.Helpers.isDarkStyle();
|
window.isDarkStyle = window.Helpers.isDarkStyle();
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ const sendMessage = () => {
|
|||||||
box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
|
box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
z-index: 1000;
|
z-index: 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user