Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README-navbar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Auto-Hiding Navigation
=========
A simple navigation that auto-hides when the user scrolls down, and becomes visible when the user scrolls up.

[Article on CodyHouse](https://codyhouse.co/gem/auto-hiding-navigation)

[Demo](https://codyhouse.co/demo/auto-hiding-navigation/nav-subnav.html)

Images: [Unsplash](https://unsplash.com/)

[Terms](https://codyhouse.co/terms/)
48 changes: 48 additions & 0 deletions css/reset.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section, main {
display: block;
}
body {
line-height: 1;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
323 changes: 323 additions & 0 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,323 @@
/* --------------------------------

Primary style

-------------------------------- */
*, *::after, *::before {
box-sizing: border-box;
}

html {
font-size: 62.5%;
}

body {
font-size: 1.6rem;
font-family: "Hind", sans-serif;
color: #25283D;
background-color: #F1F1F1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

a {
color: #353D99;
text-decoration: none;
}

/* --------------------------------

1. Auto-Hiding Navigation - Simple

-------------------------------- */
.cd-auto-hide-header {
position: fixed;
z-index: 2;
top: 0;
left: 0;
width: 100%;
height: 60px;
background-color: transparent;
/* Force Hardware Acceleration */
-webkit-transform: translateZ(0);
transform: translateZ(0);
will-change: transform;
-webkit-transition: -webkit-transform .5s;
transition: -webkit-transform .5s;
transition: transform .5s;
transition: transform .5s, -webkit-transform .5s;
}
.cd-auto-hide-header::after {
clear: both;
content: "";
display: block;
}
.cd-auto-hide-header.is-hidden {
-webkit-transform: translateY(-100%);
-ms-transform: translateY(-100%);
transform: translateY(-100%);
}
@media only screen and (min-width: 1024px) {
.cd-auto-hide-header {
height: 80px;
}
}

.cd-auto-hide-header .logo,
.cd-auto-hide-header .nav-trigger {
position: absolute;
top: 50%;
bottom: auto;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}

.cd-auto-hide-header .logo {
left: 5%;
}
.cd-auto-hide-header .logo a, .cd-auto-hide-header .logo img {
display: block;
max-height: 50px;
}

.cd-auto-hide-header .nav-trigger {
/* vertically align its content */
display: table;
height: 100%;
padding: 0 1em;
font-size: 1.2rem;
text-transform: uppercase;
color: #25283D;
font-weight: bold;
right: 0;
border-left: 1px solid #f2f2f2;
}
.cd-auto-hide-header .nav-trigger span {
/* vertically align inside parent element */
display: table-cell;
vertical-align: middle;
}
.cd-auto-hide-header .nav-trigger em, .cd-auto-hide-header .nav-trigger em::after, .cd-auto-hide-header .nav-trigger em::before {
/* this is the menu icon */
display: block;
position: relative;
height: 2px;
width: 22px;
background-color: #25283D;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.cd-auto-hide-header .nav-trigger em {
/* this is the menu central line */
margin: 6px auto 14px;
-webkit-transition: background-color .2s;
transition: background-color .2s;
}
.cd-auto-hide-header .nav-trigger em::before, .cd-auto-hide-header .nav-trigger em::after {
position: absolute;
content: '';
left: 0;
-webkit-transition: -webkit-transform .2s;
transition: -webkit-transform .2s;
transition: transform .2s;
transition: transform .2s, -webkit-transform .2s;
}
.cd-auto-hide-header .nav-trigger em::before {
/* this is the menu icon top line */
-webkit-transform: translateY(-6px);
-ms-transform: translateY(-6px);
transform: translateY(-6px);
}
.cd-auto-hide-header .nav-trigger em::after {
/* this is the menu icon bottom line */
-webkit-transform: translateY(6px);
-ms-transform: translateY(6px);
transform: translateY(6px);
}
@media only screen and (min-width: 1024px) {
.cd-auto-hide-header .nav-trigger {
display: none;
}
}

.cd-auto-hide-header.nav-open .nav-trigger em {
/* transform menu icon into a 'X' icon */
background-color: rgba(255, 255, 255, 0);
}
.cd-auto-hide-header.nav-open .nav-trigger em::before {
/* rotate top line */
-webkit-transform: rotate(-45deg);
-ms-transform: rotate(-45deg);
transform: rotate(-45deg);
}
.cd-auto-hide-header.nav-open .nav-trigger em::after {
/* rotate bottom line */
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}

.cd-primary-nav {
display: inline-block;
float: right;
height: 100%;
padding-right: 5%;
}
.cd-primary-nav > ul {
position: absolute;
z-index: 2;
top: 60px;
left: 0;
width: 100%;
background-color: #ffffff;
display: none;
box-shadow: 0 14px 20px rgba(0, 0, 0, 0.2);
}
.cd-primary-nav > ul a {
/* target primary-nav links */
display: block;
height: 50px;
line-height: 50px;
padding-left: 5%;
font-size: 1.8rem;
}
.link-nav > a:hover{
color: #36EAF2;
}


.link-nav{
padding: 10px;
}

.call-to-action-li{
background-color: #353D99;
padding: 10px;
}

.call-to-action-a {
color: #fff;
}

.call-to-action-li:hover{
color: #353D99;
background: linear-gradient(75deg, #353D99, #36EAF2);
}

@media only screen and (min-width: 1024px) {
.cd-primary-nav {
/* vertically align its content */
display: table;
}
.cd-primary-nav > ul {
/* vertically align inside parent element */
display: table-cell;
vertical-align: middle;
/* reset mobile style */
position: relative;
width: auto;
top: 0;
padding: 0;
background-color: transparent;
box-shadow: none;
}
.cd-primary-nav > ul::after {
clear: both;
content: "";
display: block;
}
.cd-primary-nav > ul li {
display: inline-block;
float: left;
margin-right: 1.5em;
}
.cd-primary-nav > ul li:last-of-type {
margin-right: 0;
}
.cd-primary-nav > ul a {
/* reset mobile style */
height: auto;
line-height: normal;
padding: 0;
border: none;
}
}

.nav-open .cd-primary-nav ul,
.cd-primary-nav ul:target {
/*
show primary nav - mobile only
:target is used to show navigation on no-js devices
*/
display: block;
}
@media only screen and (min-width: 1024px) {
.nav-open .cd-primary-nav ul,
.cd-primary-nav ul:target {
display: table-cell;
}
}

/* --------------------------------

Main content

-------------------------------- */
.cd-main-content {
padding: 60px 5% 2em;
overflow: hidden;
}
.cd-main-content.sub-nav {
/* to be used if there is sub nav */
padding-top: 110px;
}
.cd-main-content.sub-nav-hero {
/* to be used if there is hero image + subnav */
padding-top: 0;
}
.cd-main-content.sub-nav-hero.secondary-nav-fixed {
margin-top: 50px;
}
.cd-main-content p {
max-width: 1024px;
line-height: 1.6;
margin: 2em auto;
font-family: "David Libre", serif;
color: #a5a8a9;
}
@media only screen and (min-width: 1024px) {
.cd-main-content {
padding-top: 80px;
}
.cd-main-content.sub-nav {
padding-top: 150px;
}
.cd-main-content.sub-nav-hero.secondary-nav-fixed {
margin-top: 70px;
}
.cd-main-content p {
font-size: 2.4rem;
}
}

/*
adjust the positioning of in-page links
http://nicolasgallagher.com/jump-links-and-viewport-positioning/
*/
.cd-main-content.sub-nav :target::before,
.cd-main-content.sub-nav-hero :target::before {
display: block;
content: "";
margin-top: -50px;
height: 50px;
visibility: hidden;
}
@media only screen and (min-width: 1024px) {
.cd-main-content.sub-nav :target::before,
.cd-main-content.sub-nav-hero :target::before {
margin-top: -70px;
height: 70px;
}
}

Binary file added img/alistairholmes.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions img/cd-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading