blob: 2c5b9fb4f26eff6bc807bb34741103f70c5bef65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
$().ready(function(){
$(window).bind('scroll', function() {
var currentTop = $(window).scrollTop();
var currentBottom = $(window).scrollTop() + $(window).height();
var pageBottom = $('#EOF').offset().top;
var elems = $(":header");
elems.each(function(idx){
var elemTop = $(this).offset().top;
var id = $(this).attr('id');
var navElem = $('#' + id+ '-nav');
if(currentTop >= elemTop || currentBottom >= pageBottom){
navElem.addClass('toc-active');
} else {
navElem.removeClass('toc-active');
}
})
});
});
|