This commit is contained in:
ty kayn 2019-10-12 20:56:24 +02:00
parent c816a167ce
commit 4c85016d98
1 changed files with 24 additions and 24 deletions

View File

@ -13,32 +13,32 @@
</footer> </footer>
</template> </template>
<script lang="ts"> <script lang="ts">
import {Component, Vue} from 'vue-property-decorator'; import {Component, Vue} from 'vue-property-decorator';
import Logo from './Logo.vue'; import Logo from './Logo.vue';
@Component({ @Component({
components: { components: {
'mobilizon-logo': Logo, 'mobilizon-logo': Logo,
}, },
/** /**
* listen on click on the top button to go back to the top smoothly * listen on click on the top button to go back to the top smoothly
*/ */
mounted: function () { mounted() {
const btnId = 'back_to_top'; const btnId = 'back_to_top';
const btn = document.getElementById(btnId); const btn = document.getElementById(btnId);
if (btn) { if (btn) {
btn.addEventListener('click', () => window.scrollTo({ btn.addEventListener('click', () => window.scrollTo({
top: 0, top: 0,
behavior: 'smooth', behavior: 'smooth',
})); }));
} else { } else {
console.error(`back to top button reference element by ID "${btnId}" not found`) console.error(`back to top button reference element by ID "${btnId}" not found`);
} }
} },
}) })
export default class Footer extends Vue { export default class Footer extends Vue {
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "../variables.scss"; @import "../variables.scss";