-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
51 lines (44 loc) · 1.58 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<html ng-app="ScrollToggleDemo">
<head>
<title>Angular ScrollToggle Demo</title>
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="css/angular-scroll-toggle.css"/>
<style>
body{
margin-top:60px;
}
#fixed-header{
position:fixed;
top:0;
left:0;
right:0;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"></script>
<script src="js/angular-scroll-toggle.js"></script>
</head>
<body ng-controller="MyController">
<div style="height:1000vh; width:100%;">
<div scroll-toggle class="alert alert-info" role="alert" id="fixed-header" offset="400">
This header will toggle depending on the vertical scrolling direction
</div>
<center style="position:fixed;bottom:20px;left:0;right:0;">
<h1 scroll-toggle="onScroll">{{footer.text}}</h1>
</center>
</div>
<script type="text/javascript">
(function(angular){
var appName = 'ScrollToggleDemo';
var app = angular.module(appName, ['angular-scroll-toggle']);
app.controller('MyController', ['$scope', function($scope){
$scope.footer = {};
$scope.footer.text = 'Scroll Down';
$scope.onScroll = function(direction, element){
if(direction) $scope.footer.text = 'Scroll Up';
else $scope.footer.text = 'Scroll Down';
}
}])
})(angular)
</script>
</body>
</html>