forked from twbs/bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scrolling.js
27 lines (24 loc) · 879 Bytes
/
scrolling.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
<!-- A little JS to do sticky headers -->
<script src="../js/waypoints.min.js"></script>
<script type="text/javascript">
// track headers as they scroll in and out of view
var headerStack = [];
$(document).ready(function() {
$.waypoints.settings.scrollThrottle = 30;
// TODO: dynamically instantiate the header holder here
$('.dialog-header').first().clone().appendTo('.header-holder');
$('.dialog-header').waypoint(function(event, direction) {
if ( direction === "down" ) {
headerStack.push( $('.header-holder > .dialog-header').detach() );
$(this).clone().appendTo('.header-holder');
} else {
if ( headerStack.length > 0 ) {
$('.header-holder > .dialog-header').detach();
headerStack.pop().appendTo('.header-holder');
}
}
}, {
offset: 127
});
});
</script>