Detachable scrollTop button
This commit is contained in:
parent
706975e41d
commit
47d4cb8f17
7 changed files with 73 additions and 25 deletions
18
src/components/scroll_top_button/scroll_top_button.js
Normal file
18
src/components/scroll_top_button/scroll_top_button.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
const ScrollTopButton = {
|
||||
props: {
|
||||
fast: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: false
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
scrollToTop() {
|
||||
const speed = this.fast ? 'instant' : 'smooth';
|
||||
|
||||
window.scrollTo({ top: 0, behavior: speed })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export default ScrollTopButton
|
||||
29
src/components/scroll_top_button/scroll_top_button.vue
Normal file
29
src/components/scroll_top_button/scroll_top_button.vue
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<template>
|
||||
<div class="rightside-button scroll-to-top">
|
||||
<button
|
||||
class="button-unstyled scroll-to-top-button"
|
||||
type="button"
|
||||
:title="$t('general.scroll_to_top')"
|
||||
@click="scrollToTop"
|
||||
>
|
||||
<FALayers class="fa-scale-110 fa-old-padding-layer">
|
||||
<FAIcon icon="arrow-up" />
|
||||
<FAIcon
|
||||
icon="minus"
|
||||
transform="up-7"
|
||||
/>
|
||||
</FALayers>
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script src="./scroll_top_button.js"></script>
|
||||
<style lang="scss">
|
||||
.scroll-to-top {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.-scrolled .scroll-to-top {
|
||||
display: inline-block;
|
||||
}
|
||||
</style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue