Add Banner to Index page

This commit is contained in:
Patrick Neff 2019-01-05 03:59:50 +01:00
parent 73ce387427
commit f065277607
8 changed files with 39 additions and 3 deletions

View File

@ -2,4 +2,5 @@
date = "2018-12-02T19:16:57+01:00" date = "2018-12-02T19:16:57+01:00"
draft = false draft = false
title = "Neff Stein-Design" title = "Neff Stein-Design"
banner = "# Angebote vom 1.1.00 bis 1.1.01\ntest"
+++ +++

View File

@ -1,6 +1,6 @@
+++ +++
title = "Bestattungsgarten Auf Dem Parkfriedhof Sieglar" title = "Bestattungsgarten Auf Dem Parkfriedhof Sieglar"
date = "2019-01-05T02:19:56+01:00" date = "2019-01-05T18:19:56+01:00"
draft = true draft = true
type = "news" type = "news"
weight = -200 weight = -200

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,21 @@
#banner {
font-size: 1.2rem;
position: absolute;
top: 155px;
width: 100%;
transition: 0.6s;
h1 {
font-size: 1.4rem;
}
.container {
border-radius: $border-radius;
margin: 0 auto;
}
&.hidden {
top: -200px;
transition: 0.6s;
}
}

View File

@ -10,3 +10,4 @@
@import "index"; @import "index";
@import "lightbox"; @import "lightbox";
@import "content"; @import "content";
@import "banner";

View File

@ -13,6 +13,7 @@
{{- partial "header.html" . -}} {{- partial "header.html" . -}}
</div> </div>
</section> </section>
{{- partial "banner.html" . -}}
<div id="page-wrapper"> <div id="page-wrapper">
<section id="content"> <section id="content">
{{- block "content" . -}} {{- block "content" . -}}

View File

@ -0,0 +1,9 @@
{{- with .Params.banner }}
<section id="banner">
<div class="container">
<div id="banner-container">
{{ . | markdownify }}
</div>
</div>
</section>
{{- end }}

View File

@ -3,6 +3,7 @@ const scrollPosition = 50;
const menuLinks = document.querySelectorAll('.menu-list li a'); const menuLinks = document.querySelectorAll('.menu-list li a');
const checkbox = document.querySelector('#top-navigation-checkbox'); const checkbox = document.querySelector('#top-navigation-checkbox');
const banner = document.querySelector('#banner');
let lastScrollPosition = 0; let lastScrollPosition = 0;
@ -12,12 +13,14 @@ window.addEventListener('scroll', (e) => {
header.classList.add('small') header.classList.add('small')
header.classList.remove('large') header.classList.remove('large')
header.classList.add('hidden') header.classList.add('hidden')
banner.classList.add('hidden')
checkbox.checked = false; checkbox.checked = false;
} }
else { else {
if (st < scrollPosition) { if (st < scrollPosition) {
header.classList.add('large') header.classList.add('large')
header.classList.remove('small') header.classList.remove('small')
banner.classList.remove('hidden')
} }
if (st < lastScrollPosition) { if (st < lastScrollPosition) {
setTimeout(() => { setTimeout(() => {