activate last section heading when approaching footer (#21)
This commit is contained in:
parent
4d6f8a51e5
commit
12321ef691
|
@ -81,24 +81,30 @@ var $sitehead = $("#site-head");
|
|||
}
|
||||
|
||||
$post.each(function () {
|
||||
var f = $(this).offset().top;
|
||||
var b = $(this).offset().top + $(this).height();
|
||||
var t = $(this).parent(".post-holder").index();
|
||||
var i = $(".fn-item[item_index='" + t + "']");
|
||||
var a = $(this)
|
||||
.parent(".post-holder")
|
||||
.prev(".post-holder")
|
||||
.find(".post-after");
|
||||
|
||||
$(this).attr("item_index", t);
|
||||
|
||||
if (w >= f && w <= b) {
|
||||
i.addClass("active");
|
||||
a.fadeOut("slow");
|
||||
if (($(window).height() + w) > ($(document).height() - $(".site-footer").height())) {
|
||||
var l = $postholder.length;
|
||||
$(".fn-item[item_index='" + (l - 1) + "']").removeClass("active")
|
||||
$(".fn-item[item_index='" + (l) + "']").addClass("active")
|
||||
} else {
|
||||
i.removeClass("active");
|
||||
a.fadeIn("slow");
|
||||
}
|
||||
var f = $(this).offset().top;
|
||||
var b = $(this).offset().top + $(this).height();
|
||||
var t = $(this).parent(".post-holder").index();
|
||||
var i = $(".fn-item[item_index='" + t + "']");
|
||||
var a = $(this)
|
||||
.parent(".post-holder")
|
||||
.prev(".post-holder")
|
||||
.find(".post-after");
|
||||
|
||||
$(this).attr("item_index", t);
|
||||
|
||||
if (w >= f && w <= b) {
|
||||
i.addClass("active");
|
||||
a.fadeOut("slow");
|
||||
} else {
|
||||
i.removeClass("active");
|
||||
a.fadeIn("slow");
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue