removed JS from footer, now pinned to bottom w/ pure css

This commit is contained in:
worktop 2024-02-22 16:04:54 -05:00
parent 9e5d95551b
commit 9969b19f99
2 changed files with 9 additions and 16 deletions

View File

@ -2,18 +2,5 @@
<hr/> <hr/>
<a href="/{{ .Language.LanguageCode }}">{{ .Site.Title }}</a><br/> <a href="/{{ .Language.LanguageCode }}">{{ .Site.Title }}</a><br/>
</footer> </footer>
<script>
// JavaScript to check if content is shorter than the screen
// and add fixed class to footer if needed
window.addEventListener('DOMContentLoaded', function() {
var content = document.querySelector('.content');
var footer = document.querySelector('footer');
if (content.offsetHeight < window.innerHeight) {
footer.classList.add('fixed');
}
});
</script>
</body> </body>
</html> </html>

View File

@ -17,6 +17,9 @@ body{
line-height: 1.5; line-height: 1.5;
background-color: var(--bg); background-color: var(--bg);
color: var(--fg); color: var(--fg);
display: flex;
flex-direction: column;
min-height: 100vh;
} }
a{ a{
@ -26,7 +29,11 @@ a{
/* Main Body */ /* Main Body */
.content { margin: 5em 5% auto 5%; } .content {
margin: 5em 5% auto 5%;
flex: 1;
}
footer { footer {
width: calc(100% - 40px); width: calc(100% - 40px);
@ -427,5 +434,4 @@ blockquote.location p { padding: inherit; }
} }
} }