<!DOCTYPE html >
<html ng-app="demoHeader">
<head>
<link rel="stylesheet" href="style.css">
<link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
</head>
<body id="page">
<header id="header" hide-header hide-offset="60">
<h1 >Testing</h1>
</header>
<section class="content">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</section>
<section class="content">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</section>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>
<script src="script.js"></script>
<script src="angular-hide-header.min.js"></script>
</body>
</html>
// Code goes here
var demoHeader = angular.module('demoHeader',['angularHideHeader']);
/* Styles go here */
body {
height: 1000px;
margin:0;
padding:0;
font-family:'Lato';
}
header{
display: block;
height:55px;
background-color:#4d4d4d;
position: fixed;
top:0px;
margin:0;
padding:0;
line-height:55px;
width:100%;
-webkit-transition: top 0.25s;
-moz-transition: top 0.25s;
-ms-transition: top 0.25s;
-o-transition: top 0.25s;
transition: top 0.25s;
}
header h1{
color:#ffffff;
padding:0;
margin:0px auto;
text-align:center;
}
section{
padding:60px 10px 20px;
}
section p{
line-height:18px;
padding:5px;
}
(function(){"use strict";angular.module("angularHideHeader",[]).directive("hideHeader",["$timeout","$window",function(e,t){return{restrict:"A",link:function(n,r,i){var s=0,o;var u=i.hideOffset;angular.element(t).bind("scroll",function(){var t=angular.element(document.getElementsByTagName("body"));var n=t[0].scrollTop;var i=r[0].scrollHeight;var a=parseInt(u);e.cancel(o);if(n>=i+a){if(n<=s){r.removeClass("hideh");r.css({top:"0px"})}else{r.addClass("hideh");r.css({top:-i+"px",transition:"top 0.25s","-webkit-transition":"top 0.25s","-moz-transition":"top 0.25s","-ms-transition":"top 0.25s","-o-transition":"top 0.25s"})}}else if(n>=i){r.removeClass("hideh");r.css({top:"0px"})}o=e(function(){s=t[0].scrollTop},60)})}}}])})()