Skip to content

Commit

Permalink
#42 Footer is now only position-fixed when window is not scrollable
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed Jun 21, 2021
1 parent 6e0449f commit 4bf5578
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/PageStrcture/Footer.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<!-- User Footer -->
<footer v-if="text && text !== ''" v-html="text"></footer>
<footer v-if="text && text !== ''" v-html="text" :class="!scrollVisible ? 'fixed' : ''"></footer>
<!-- Default Footer -->
<footer v-else>
<footer v-else :class="!scrollVisible ? 'fixed' : ''">
Developed by <a :href="authorUrl">{{authorName}}</a>.
Licensed under <a :href="licenseUrl">{{license}}</a>
{{ showCopyright? '©': '' }} {{date}}.
Expand All @@ -23,14 +23,19 @@ export default {
showCopyright: { type: Boolean, default: true },
repoUrl: { type: String, default: 'https://github.com/lissy93/dashy' },
},
data: () => ({
scrollVisible: false,
}),
mounted() {
this.scrollVisible = document.body.clientHeight > window.innerHeight;
},
};
</script>

<style scoped lang="scss">
footer {
position: fixed;
width: 100%;
width: calc(100% - 0.5rem);
bottom: 0;
padding: 0.25rem;
text-align: center;
Expand All @@ -39,6 +44,7 @@ footer {
background: var(--background-darker);
margin-top: 1.5rem;
border-top: 1px solid var(--outline-color);
&.fixed { position: fixed; }
}
footer a{
Expand Down

0 comments on commit 4bf5578

Please sign in to comment.