Skip to content

Commit 4bf5578

Browse files
committed
#42 Footer is now only position-fixed when window is not scrollable
1 parent 6e0449f commit 4bf5578

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/components/PageStrcture/Footer.vue

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<template>
22
<!-- User Footer -->
3-
<footer v-if="text && text !== ''" v-html="text"></footer>
3+
<footer v-if="text && text !== ''" v-html="text" :class="!scrollVisible ? 'fixed' : ''"></footer>
44
<!-- Default Footer -->
5-
<footer v-else>
5+
<footer v-else :class="!scrollVisible ? 'fixed' : ''">
66
Developed by <a :href="authorUrl">{{authorName}}</a>.
77
Licensed under <a :href="licenseUrl">{{license}}</a>
88
{{ showCopyright? '©': '' }} {{date}}.
@@ -23,14 +23,19 @@ export default {
2323
showCopyright: { type: Boolean, default: true },
2424
repoUrl: { type: String, default: 'https://github.com/lissy93/dashy' },
2525
},
26+
data: () => ({
27+
scrollVisible: false,
28+
}),
29+
mounted() {
30+
this.scrollVisible = document.body.clientHeight > window.innerHeight;
31+
},
2632
};
2733
</script>
2834

2935
<style scoped lang="scss">
3036
3137
footer {
32-
position: fixed;
33-
width: 100%;
38+
width: calc(100% - 0.5rem);
3439
bottom: 0;
3540
padding: 0.25rem;
3641
text-align: center;
@@ -39,6 +44,7 @@ footer {
3944
background: var(--background-darker);
4045
margin-top: 1.5rem;
4146
border-top: 1px solid var(--outline-color);
47+
&.fixed { position: fixed; }
4248
}
4349
4450
footer a{

0 commit comments

Comments
 (0)