提交 53573323 编写于 作者: J Johan Preynat

Handle setting hash-referenced chapters as active on click

上级 f2bd1afc
......@@ -33,6 +33,18 @@ function scrollToHash(hash) {
$scroller.animate({
scrollTop: dest
}, 800, 'swing');
// Update summary active chapter
$('.book-summary').find('.chapter.active').removeClass('active');
$('.book-summary .chapter > a').each(function() {
var uri = url.resolve(window.location.pathname, $(this).attr('href')),
windowLocation = window.location.pathname + window.location.hash;
// Same page
if (uri == windowLocation) {
$(this).parent('.chapter').addClass('active');
}
});
}
/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册