Merge pull request #175 from PaulAdamDavis/navigation

Navigation
This commit is contained in:
John O'Nolan 2015-02-28 11:41:15 +02:00
commit c516c10383
9 changed files with 194 additions and 106 deletions

View file

@ -1,4 +1,4 @@
/* ========================================================================== ==========================================================================
Table of Contents Table of Contents
========================================================================== */ ========================================================================== */
@ -465,6 +465,22 @@ margin on the iframe, cause it breaks stuff. */
vertical-align: middle; vertical-align: middle;
} }
/* Wraps the main content & footer */
.site-wrapper {
position: relative;
z-index: 10;
min-height: 100%;
background: #fff;
-webkit-transition: -webkit-transform 0.5s ease;
transition: transform 0.5s ease;
}
body.nav-opened .site-wrapper {
-webkit-transform: translate3D(-240px, 0, 0);
-ms-transform: translate3D(-240px, 0, 0);
transform: translate3D(-240px, 0, 0);
}
/* ========================================================================== /* ==========================================================================
4. General - The main styles for the the theme 4. General - The main styles for the the theme
@ -475,7 +491,7 @@ margin on the iframe, cause it breaks stuff. */
position: relative; position: relative;
display: table; display: table;
width: 100%; width: 100%;
height: 100%; height: 100vh;
margin-bottom: 5rem; margin-bottom: 5rem;
text-align: center; text-align: center;
background: #222 no-repeat center center; background: #222 no-repeat center center;
@ -498,6 +514,114 @@ margin on the iframe, cause it breaks stuff. */
font-family: 'Open Sans', sans-serif; font-family: 'Open Sans', sans-serif;
} }
/* Navigation */
body.nav-opened .nav-cover {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 200;
}
.nav {
position: fixed;
top: 0;
right: 0;
bottom: 0;
z-index: 5;
width: 240px;
background: #2E2E2E;
margin-bottom: 0;
text-align: left;
overflow-y: auto;
-webkit-transition: -webkit-transform 0.5s ease;
transition: transform 0.5s ease;
}
body.nav-closed .nav {
-webkit-transform: translate3D(100px, 0, 0);
-ms-transform: translate3D(100px, 0, 0);
transform: translate3D(100px, 0, 0);
}
body.nav-opened .nav {
-webkit-transform: translate3D(0, 0, 0);
-ms-transform: translate3D(0, 0, 0);
transform: translate3D(0, 0, 0);
}
a.nav-close {
position: absolute;
top: 15px;
right: 15px;
width: 30px;
height: 30px;
padding: 0;
}
.nav-close:focus {
outline: 0;
}
.nav-close:before,
.nav-close:after {
content: '';
position: absolute;
top: 0;
width: 30px;
height: 1px;
background: rgb(150,150,150);
top: 15px;
-webkit-transition: background 0.15s ease;
transition: background 0.15s ease;
}
.nav-close:before {
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
.nav-close:after {
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.nav-close:hover:before,
.nav-close:hover:after {
background: rgb(255,255,255);
}
.nav ul {
padding: 50px 9% 5%;
}
.nav li {
list-style: none;
margin: 0;
}
.nav li a {
text-decoration: none;
font-family: "Open Sans", sans-serif;
line-height: 1.4;
font-size: 1.5rem;
display: block;
padding: 0.6rem 4%;
}
.nav a:link,
.nav a:visited {
color: #B8B8B8;
}
.nav li.nav-current a,
.nav a:hover,
.nav a:active,
.nav a:focus {
color: #fff;
}
/* Create a bouncing scroll-down arrow on homepage with cover image */ /* Create a bouncing scroll-down arrow on homepage with cover image */
.scroll-down { .scroll-down {
display: block; display: block;
@ -593,7 +717,7 @@ margin on the iframe, cause it breaks stuff. */
margin-right: 8px; margin-right: 8px;
} }
.subscribe-button { .menu-button {
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
box-sizing: border-box; box-sizing: border-box;
@ -612,11 +736,18 @@ margin on the iframe, cause it breaks stuff. */
background: rgba(0,0,0,0.1); background: rgba(0,0,0,0.1);
transition: all 0.3s ease; transition: all 0.3s ease;
} }
.subscribe-button:before { .menu-button:focus {
font-size: 9px; outline: 0;
}
.menu-button span {
font-size: 12px;
margin-right: 6px; margin-right: 6px;
} }
body.nav-opened .menu-button {
opacity: 0;
}
/* Special styles when overlaid on an image*/ /* Special styles when overlaid on an image*/
.main-nav.overlay { .main-nav.overlay {
position: absolute; position: absolute;
@ -629,7 +760,7 @@ margin on the iframe, cause it breaks stuff. */
} }
.no-cover .main-nav.overlay, .no-cover .main-nav.overlay,
.no-cover .back-button, .no-cover .back-button,
.no-cover .subscribe-button { .no-cover .menu-button {
background: none; background: none;
} }
@ -638,7 +769,7 @@ margin on the iframe, cause it breaks stuff. */
} }
.main-nav.overlay .back-button, .main-nav.overlay .back-button,
.main-nav.overlay .subscribe-button { .main-nav.overlay .menu-button {
border-color: rgba(255,255,255,0.6); border-color: rgba(255,255,255,0.6);
} }
@ -651,7 +782,7 @@ margin on the iframe, cause it breaks stuff. */
/* Add a border to the buttons on hover */ /* Add a border to the buttons on hover */
.back-button:hover, .back-button:hover,
.subscribe-button:hover { .menu-button:hover {
border-color: #bfc8cd; border-color: #bfc8cd;
color: #9EABB3; color: #9EABB3;
} }
@ -691,7 +822,7 @@ margin on the iframe, cause it breaks stuff. */
} }
.no-cover .main-nav.overlay .back-button, .no-cover .main-nav.overlay .back-button,
.no-cover .main-nav.overlay .subscribe-button { .no-cover .main-nav.overlay .menu-button {
color: rgba(0,0,0,0.4); color: rgba(0,0,0,0.4);
border-color: rgba(0,0,0,0.3); border-color: rgba(0,0,0,0.3);
} }
@ -971,89 +1102,13 @@ body:not(.post-template) .post-title {
color: #50585D; color: #50585D;
} }
/* The subscribe icon on the footer */
.subscribe {
width: 28px;
height: 28px;
position: absolute;
top: -14px;
left: 50%;
margin-left: -15px;
border: #EBF2F6 1px solid;
text-align: center;
line-height: 2.4rem;
border-radius: 50px;
background: #FFF;
transition: box-shadow 0.5s;
}
/* The RSS icon, inserted via icon font */
.subscribe:before {
color: #D2DEE3;
font-size: 10px;
position: absolute;
top: 2px;
left: 9px;
font-weight: 700;
transition: color 0.5s ease;
}
/* Add a box shadow to on hover */
.subscribe:hover {
box-shadow: rgba(0,0,0,0.05) 0 0 0 3px;
transition: box-shadow 0.25s;
}
.subscribe:hover:before {
color: #50585D;
}
/* CSS tooltip saying "Subscribe!" - initially hidden */
.tooltip {
opacity: 0;
display: block;
width: 53px;
padding: 4px 8px 5px 8px;
position:absolute;
top: -23px;
left: -21px;
color: rgba(255,255,255,0.9);
font-size: 1.1rem;
line-height: 1em;
text-align: center;
background: #50585D;
border-radius: 20px;
box-shadow: 0 1px 4px rgba(0,0,0,0.1);
transition: opacity 0.3s ease, top 0.3s ease;
}
/* The little chiclet arrow under the tooltip, pointing down */
.tooltip:after {
content: " ";
border-width: 5px 5px 0 5px;
border-style: solid;
border-color: #50585D transparent;
display: block;
position: absolute;
bottom: -4px;
left: 50%;
margin-left: -5px;
z-index: 220;
width: 0;
}
/* On hover, show the tooltip! */
.subscribe:hover .tooltip {
opacity: 1;
top: -33px;
}
/* ========================================================================== /* ==========================================================================
6. Author profile 6. Author profile
========================================================================== */ ========================================================================== */
.post-head.main-header { .post-head.main-header {
height: 65%; height: 65vh;
min-height: 180px; min-height: 180px;
} }
@ -1065,17 +1120,17 @@ body:not(.post-template) .post-title {
} }
.tag-head.main-header { .tag-head.main-header {
height: 40%; height: 40vh;
min-height: 180px; min-height: 180px;
} }
.author-head.main-header { .author-head.main-header {
height: 40%; height: 40vh;
min-height: 180px; min-height: 180px;
} }
.no-cover.author-head.main-header { .no-cover.author-head.main-header {
height: 10%; height: 10vh;
min-height: 100px; min-height: 100px;
background: transparent; background: transparent;
} }
@ -1486,7 +1541,7 @@ body:not(.post-template) .post-title {
} }
.back-button, .back-button,
.subscribe-button { .menu-button {
height: 44px; height: 44px;
line-height: 41px; line-height: 41px;
border-radius: 0; border-radius: 0;
@ -1494,7 +1549,7 @@ body:not(.post-template) .post-title {
background: transparent; background: transparent;
} }
.back-button:hover, .back-button:hover,
.subscribe-button:hover { .menu-button:hover {
border-color: #ebeef0; border-color: #ebeef0;
color: #2e2e2e; color: #2e2e2e;
background: #ebeef0; background: #ebeef0;
@ -1504,7 +1559,7 @@ body:not(.post-template) .post-title {
padding: 0 15px 0 10px; padding: 0 15px 0 10px;
} }
.subscribe-button { .menu-button {
padding: 0 12px; padding: 0 12px;
} }
@ -1518,12 +1573,12 @@ body:not(.post-template) .post-title {
background: none; background: none;
} }
.no-cover .main-nav.overlay .back-button, .no-cover .main-nav.overlay .back-button,
.no-cover .main-nav.overlay .subscribe-button { .no-cover .main-nav.overlay .menu-button {
border: none; border: none;
} }
.main-nav.overlay .back-button, .main-nav.overlay .back-button,
.main-nav.overlay .subscribe-button { .main-nav.overlay .menu-button {
border-color: transparent; border-color: transparent;
} }

View file

@ -59,6 +59,11 @@
$(".scroll-down").arctic_scroll(); $(".scroll-down").arctic_scroll();
$(".menu-button, .nav-cover, .nav-close").on("click", function(e){
e.preventDefault();
$("body").toggleClass("nav-opened nav-closed");
});
}); });
// smartresize // smartresize

View file

@ -8,7 +8,9 @@
<header class="main-header author-head {{#if cover}}" style="background-image: url({{cover}}){{else}}no-cover{{/if}}"> <header class="main-header author-head {{#if cover}}" style="background-image: url({{cover}}){{else}}no-cover{{/if}}">
<nav class="main-nav overlay clearfix"> <nav class="main-nav overlay clearfix">
<a class="back-button icon-arrow-left" href="{{@blog.url}}">Home</a> <a class="back-button icon-arrow-left" href="{{@blog.url}}">Home</a>
<a class="subscribe-button icon-feed" href="{{url}}rss/">{{name}}</a> {{#if ../navigation}}
<a class="menu-button" href="#"><span>&#9776;</span>Menu</a>
{{/if}}
</nav> </nav>
</header> </header>

View file

@ -21,15 +21,23 @@
{{! Ghost outputs important style and meta data with this tag }} {{! Ghost outputs important style and meta data with this tag }}
{{ghost_head}} {{ghost_head}}
</head> </head>
<body class="{{body_class}}"> <body class="{{body_class}} nav-closed">
{{! Everything else gets inserted here }}
{{{body}}}
<footer class="site-footer clearfix"> {{navigation}}
<section class="copyright"><a href="{{@blog.url}}">{{@blog.title}}</a> &copy; {{date format="YYYY"}}</section>
<section class="poweredby">Proudly published with <a href="https://ghost.org">Ghost</a></section> <div class="site-wrapper">
</footer>
{{! Everything else gets inserted here }}
{{{body}}}
<footer class="site-footer clearfix">
<section class="copyright"><a href="{{@blog.url}}">{{@blog.title}}</a> &copy; {{date format="YYYY"}}</section>
<section class="poweredby">Proudly published with <a href="https://ghost.org">Ghost</a></section>
</footer>
<span class="nav-cover"></span>
</div>
{{! Ghost outputs important scripts and data with this tag }} {{! Ghost outputs important scripts and data with this tag }}
{{ghost_foot}} {{ghost_foot}}

View file

@ -5,7 +5,9 @@
<header class="main-header {{#if @blog.cover}}" style="background-image: url({{@blog.cover}}){{else}}no-cover{{/if}}"> <header class="main-header {{#if @blog.cover}}" style="background-image: url({{@blog.cover}}){{else}}no-cover{{/if}}">
<nav class="main-nav overlay clearfix"> <nav class="main-nav overlay clearfix">
{{#if @blog.logo}}<a class="blog-logo" href="{{@blog.url}}"><img src="{{@blog.logo}}" alt="Blog Logo" /></a>{{/if}} {{#if @blog.logo}}<a class="blog-logo" href="{{@blog.url}}"><img src="{{@blog.logo}}" alt="Blog Logo" /></a>{{/if}}
<a class="subscribe-button icon-feed" href="{{@blog.url}}/rss/">Subscribe</a> {{#if navigation}}
<a class="menu-button" href="#"><span>&#9776;</span>Menu</a>
{{/if}}
</nav> </nav>
<div class="vertical"> <div class="vertical">
<div class="main-header-content inner"> <div class="main-header-content inner">

View file

@ -9,7 +9,9 @@
<header class="main-header post-head {{#if image}}" style="background-image: url({{image}}){{else}}no-cover{{/if}}"> <header class="main-header post-head {{#if image}}" style="background-image: url({{image}}){{else}}no-cover{{/if}}">
<nav class="main-nav {{#if image}}overlay{{/if}} clearfix"> <nav class="main-nav {{#if image}}overlay{{/if}} clearfix">
<a class="back-button icon-arrow-left" href="{{@blog.url}}">Home</a> <a class="back-button icon-arrow-left" href="{{@blog.url}}">Home</a>
<a class="subscribe-button icon-feed" href="{{@blog.url}}/rss/">Subscribe</a> {{#if ../navigation}}
<a class="menu-button" href="#"><span>&#9776;</span>Menu</a>
{{/if}}
</nav> </nav>
</header> </header>

10
partials/navigation.hbs Normal file
View file

@ -0,0 +1,10 @@
<div class="nav">
<a href="#" class="nav-close">
<span class="hidden">Close</span>
</a>
<ul>
{{#foreach navigation}}
<li class="nav-{{slug}}{{#if current}} nav-current{{/if}}" role="presentation"><a href="{{url absolute="true"}}">{{label}}</a></li>
{{/foreach}}
</ul>
</div>

View file

@ -9,7 +9,9 @@
<header class="main-header post-head {{#if image}}" style="background-image: url({{image}}){{else}}no-cover{{/if}}"> <header class="main-header post-head {{#if image}}" style="background-image: url({{image}}){{else}}no-cover{{/if}}">
<nav class="main-nav {{#if image}}overlay{{/if}} clearfix"> <nav class="main-nav {{#if image}}overlay{{/if}} clearfix">
<a class="back-button icon-arrow-left" href="{{@blog.url}}">Home</a> <a class="back-button icon-arrow-left" href="{{@blog.url}}">Home</a>
<a class="subscribe-button icon-feed" href="{{@blog.url}}/rss/">Subscribe</a> {{#if ../navigation}}
<a class="menu-button" href="#"><span>&#9776;</span>Menu</a>
{{/if}}
</nav> </nav>
</header> </header>

View file

@ -5,7 +5,9 @@
<header class="main-header tag-head {{#if tag.image}}" style="background-image: url({{tag.image}}){{else}}{{#if @blog.cover}}" style="background-image: url({{@blog.cover}}){{else}}no-cover{{/if}}{{/if}}"> <header class="main-header tag-head {{#if tag.image}}" style="background-image: url({{tag.image}}){{else}}{{#if @blog.cover}}" style="background-image: url({{@blog.cover}}){{else}}no-cover{{/if}}{{/if}}">
<nav class="main-nav overlay clearfix"> <nav class="main-nav overlay clearfix">
<a class="back-button icon-arrow-left" href="{{@blog.url}}">Home</a> <a class="back-button icon-arrow-left" href="{{@blog.url}}">Home</a>
<a class="subscribe-button icon-feed" href="{{@blog.url}}/tag/{{tag.slug}}/rss/">{{tag.name}}</a> {{#if navigation}}
<a class="menu-button" href="#"><span>&#9776;</span>Menu</a>
{{/if}}
</nav> </nav>
<div class="vertical"> <div class="vertical">
<div class="main-header-content inner"> <div class="main-header-content inner">