Fixed navbar

This commit is contained in:
Damillora 2019-11-13 18:50:52 +07:00
parent 98a2e9fe13
commit 8f2affea9d
9 changed files with 14 additions and 16 deletions

View File

@ -7,10 +7,13 @@
html {
@apply font-sans;
}
/* 2. Site Header */
header {
@apply py-4 px-4 bg-yuika-blue-700;
@apply py-4 px-4;
}
/* 2. Site Header */
.index-navbar {
z-index: 10;
@apply transition-bg;
}
.index-navbar header {
background-color: transparent;
@ -161,7 +164,6 @@ footer {
}
.nav-fixed {
z-index: 10;
@apply bg-yuika-blue-700;
}

View File

@ -31,14 +31,10 @@
var progressMax = lastDocumentHeight - lastWindowHeight;
// show/hide nav
if (lastScrollY >= trigger - 20) {
nav.classList.add('fixed');
if (lastScrollY >= nav.getBoundingClientRect().bottom) {
nav.classList.add('nav-fixed');
nav.classList.remove('absolute');
} else {
nav.classList.remove('fixed');
nav.classList.remove('nav-fixed');
nav.classList.add('absolute');
}
ticking = false;

View File

@ -1,5 +1,6 @@
{{!< default}}
{{#author}}
{{> "site-header"}}
<div class="relative group index-header">
{{> header-background background=cover_image}} {{!--Special header-image.hbs partial to generate the background image--}}
<div class="h-full opacity-50 bg-black group-hover:opacity-75 transition-opacity">
@ -45,7 +46,6 @@
</div>
</div>
</div>
{{> "site-header"}}
</div>
{{/author}}

View File

@ -1,10 +1,10 @@
{{!< default}}
{{> "site-header"}}
<div class="h-64 relative group index-header">
{{> header-background background=@site.cover_image}} {{!--Special header-image.hbs partial to generate the background image--}}
<div class="w-full h-full opacity-50 bg-black group-hover:opacity-75 transition-opacity">
</div>
</div>
{{> "site-header"}}
</div>
<div class="flex flex-wrap justify-start post-feed content w-full px-4">
{{#foreach posts}}

View File

@ -1,7 +1,7 @@
{
"name": "yuika",
"description": "nanao.moe's blog theme",
"version": "0.5.0",
"version": "0.6.0",
"engines": {
"ghost-api": "v3"
},

View File

@ -1,6 +1,7 @@
{{!< default}}
{{#post}}
{{> "site-header"}}
<div class="relative group index-header">
{{> header-background background=feature_image}} {{!--Special header-image.hbs partial to generate the background image--}}
<div class="h-full opacity-50 bg-black group-hover:opacity-75 transition-opacity">
@ -13,7 +14,6 @@
</div>
</div>
</div>
{{> "site-header"}}
</div>
<article class="post-article">

View File

@ -1,4 +1,4 @@
<div class="w-full flex flex-row justify-begin items-center absolute top-0 index-navbar">
<div class="w-full flex flex-row justify-begin items-center fixed index-navbar">
<header class="flex flex-row py-2 flex-wrap w-full">
{{#if @site.logo}}
<div class="w-12 h-12">

View File

@ -1,6 +1,7 @@
{{!< default}}
{{#post}}
{{> "site-header"}}
<div class="relative group index-header">
{{> header-background background=feature_image}} {{!--Special header-image.hbs partial to generate the background image--}}
<div class="h-full opacity-50 bg-black group-hover:opacity-75 transition-opacity">
@ -39,7 +40,6 @@
</div>
</div>
</div>
{{> "site-header"}}
</div>
<article class="post-article">

View File

@ -1,6 +1,7 @@
{{!< default}}
{{#tag}}
{{> "site-header"}}
<div class="relative group index-header">
{{> header-background background=feature_image}} {{!--Special header-image.hbs partial to generate the background image--}}
<div class="h-full opacity-50 bg-black group-hover:opacity-75 transition-opacity">
@ -23,7 +24,6 @@
</div>
</div>
</div>
{{> "site-header"}}
</div>
{{/tag}}