JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<body class="index m-scene" id="main">
<!-- // Start HTML \\ -->
<header id="header" class="fixed">
<div class="container_12">
<h1 class="grid_4">
<a href="#" class="logo backtotop">
<img src="images/logo.png" alt="">
<span>Maurice Draait</span>
</a>
</h1><!-- End h1.grid_4 -->
<div class="grid_8">
<a href="#" class="toggle-menu"><span>Menu</span></a>
<nav id="primary-navwrapper" class="pushy-right">
<ul id="listnav">
<li><a href="#" class="current">Home</a></li>
<li><a href="#aboutus">About us</a></li>
<li><a href="#events">Agenda</a></li>
<li><a href="#gallery">Galerij</a></li>
<li><a href="#organisation">Organisatie</a></li>
<li><a href="#contact">Contact</a></li>
</ul><!-- End ul#listnav -->
</nav><!-- End nav#primary-navwrapper .pushy-right -->
</div><!-- End div.grid_8 -->
<div class="clear"></div><!-- End div.clear -->
</div><!-- End div.container_12 -->
</header><!-- End header#header .fixed -->
<div class="m-page scene_element scene_element--fadeinup">
<main class="container">
<section id="hero">
<figure>
<figcaption>
<div class="container_12">
<hgroup class="grid_12">
<h1>
Headline 1
</h1>
<h2>
Headline 2
</h2>
<h3>
Donec sed odio dui. Nulla vitae elit libero, a pharetra augue.
<br>
Nullam id dolor id nibh ultricies vehicula ut id elit.
</h3>
</hgroup><!-- End hgroup.grid_12 -->
<div class="clear"></div><!-- End div.clear -->
</div><!-- End div.container_12 center -->
</figcaption>
</figure><!-- End figure -->
</section><!-- End section#hero -->
<section id="aboutus" class="e-waypoint">
<div class="container_12 center">
<header class="grid_12 center">
<h3>Maurice Draait</h3>
<p>
Duis aute irure dolor in...
CSS
/* ********************************************************************************* */
/* 0. CSS Reset & Clearfix */
/* ********************************************************************************* */
* {
margin: 0;
padding: 0;
border: 0 none;
outline: 0;
list-style: none;
font-size: 100%;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
img, a img {
max-width: 100%;
vertical-align: middle;
}
article, aside, details, figcaption, figure, footer, header, hgroup, nav, section { display: block; } /* HTML5 Resets for older browsers */
.clearfix:after { content: '.'; height: 0; display: block; clear: both; visibility: hidden; } .clearfix { *zoom: 1; display: block; } /* Hide from IE Mac */ .none { display: none; }
/* Mozilla based browsers */
::-moz-selection {
background-color: #000;
color: #FFF;
}
/* Works in Safari */
::selection {
background-color: #000;
color: #FFF;
}
/* ********************************************************************************* */
/* 1. Document Setup */
/* ********************************************************************************* */
/*
Colors - Color / sort / code
# Dark Gray (headings, paragraphs, links) #61616a
# Light Gray-blue #61616a
# Light Blue (hr) #e2e5eb
# Black #000
# White #FFF
# Orange #fcb82b
*/
/*
Headings - font / PT/PX / line-height / letter-spacing
# H1 Ubuntu Bold 60pt / 100 / 10
# H2 Ubuntu Regular 46pt / 56 / 20
# H3 Ubuntu Bold 18pt / 26 / 20
*/
a {
text-decoration: none;
transition: color 0.1s linear;
-moz-transition: color 0.1s linear;
-webkit-transition: color 0.1s linear;
-o-transition: color 0.1s linear;
}
a:link, a:visited { color: inherit; } /* Body color */
a:hover, a:active { color: #fcb82b; }
h1, h2, h3, h4, h5, h6 { font-weight: normal; }
h1 {
font-size: 60px; /* 60px / 16px = 100% */
font-weight: 700;
line-height: 100px;
}
h2 { font-size: 40px; /* 40px / 16px = 100% */ }
h3 {
font-size:...
JavaScript
// JavaScript Document
// Can also be used with $(document).ready() / $(window).load()
$(document).ready(function(){
// An offset to push the content down from the top
var offset = $('#header').outerHeight();
$('#primary-navwrapper li').find('a[href^="#"]').click(function(event) {
// Prevent from default action to intitiate
event.preventDefault();
$('#primary-navwrapper li a').removeClass("current");
$(this).addClass("current");
// The id of the section we want to go to.
var anchorId = $(this).attr("href");
// Our scroll target : the top position of the
// section that has the id referenced by our href.
var target = $(anchorId).offset().top - offset;
//console.log(target);
$('html, body').animate({ scrollTop: target }, 500, function () {
//window.location.hash = '!' + id;
window.location.hash = anchorId;
});
});
function setActiveListElements(event){
// Get the offset of the window from the top of page
var windowPos = $(window).scrollTop();
var section
$('#primary-navwrapper li a[href^="#"]').each(function() {
var anchorId = $(this);
var target = $(anchorId.attr("href"));
if (target.length > 0) {
if (target.position().top <= windowPos && target.position().top + target.height() > windowPos) {
$('#primary-navwrapper li a').removeClass("current");
anchorId.addClass("current");
}
}
});
}
$(window).scroll(function() {
setActiveListElements();
});
});