/
Init.js
58 lines (46 loc) · 944 Bytes
/
Init.js
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
52
53
54
55
56
57
58
(function(Sidebar){
// Quick and dirty IE detection
var isIE = (function(){
if (window.navigator.userAgent.match('Trident')) {
return true;
} else {
return false;
}
})();
// isIE = true;
var Init = {
start: function(){
var id = document.body.id.toLowerCase();
if (this.Pages[id]) {
this.Pages[id]();
}
},
initializeSidebar: function(){
new Sidebar();
},
initializeWaypoints: function(){
$('#header').waypoint(function(event, direction) {
console.log('waypoint header ', $(this)[0]);
$(this.element).addClass('showit');
}, {
offset: function() {
return 25%;
}
});
$('#hero').waypoint(function(event, direction) {
$(this.element).addClass('showit');
}, {
offset: function() {
return 25%;
}
});
},
Pages: {
'page-home': function(){
Init.initializeSidebar();
Init.initializeWaypoints();
}
}
};
Init.start();
})(window.Sidebar);