Having a sliding underline URL effect (viewable here: http://codepen.io/Dingerzat/pen/XNgKmR), I encountered an issue when combining it with a resizing header. The resizing header caused the sliding underline effect to stop working. After some troubleshooting, I identified the culprit as the line-height property in the "header nav" class within the resizing header CSS. However, this line-height is necessary for the resizing header links to adjust when scrolling.
Is there a way to make these two pieces of code work together harmoniously?
Here is my attempt at combining them: http://codepen.io/Dingerzat/pen/bBRejp
/* CSS */
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, font, 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 {
background: transparent;
border: 0;
margin: 0;
padding: 0;
vertical-align: baseline; }
body {
line-height: 1; }
h1, h2, h3, h4, h5, h6 {
clear: both;
font-weight: normal; }
ol, ul {
list-style: none; }
blockquote {
quotes: none; }
blockquote:before, blockquote:after {
content: '';
content: none; }
del {
text-decoration: line-through; }
/* tables still need 'cellspacing="0"' in the markup */
table {
border-collapse: collapse;
...
<!-- HTML -->
<!-- title and meta -->
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<meta name="description" content="" />
<title>Header Resize On Scroll with Animations</title>
<!-- css -->
<link href='http://fonts.googleapis.com/css?family=Ubuntu:300,400,700,400italic' rel='stylesheet' type='text/css'>
<link href='http://fonts.googleapis.com/css?family=Oswald:400,300,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="css/style.css" />
<!-- js -->
<script src="js/classie.js"></script>
<script>
function init() {
window.addEventListener('scroll', function(e){
var distanceY = window.pageYOffset || document.documentElement.scrollTop,
shrinkOn = 300,
header = document.querySelector("header");
if (distanceY > shrinkOn) {
classie.add(header,"smaller");
} else {
if (classie.has(header,"smaller")) {
classie.remove(header,"smaller");
...