Commit b4507a6a authored by Hiroyuki Sato's avatar Hiroyuki Sato 🇯🇵

ハッシュ付きリンクを開いた時にアンカーにスクロールしない不具合を修正

parent d3f1bd64
Pipeline #73508667 passed with stages
in 8 minutes and 30 seconds
......@@ -116,7 +116,18 @@ $(function() {
var elTop = $el.offset().top;
var elPosition = elTop - $(window).scrollTop();
if (elPosition < extraHeight) {
var $target = $(document.querySelectorAll(hash));
var $visibleLink;
$target.each(function() {
if ($(this).parent().is(':visible')) {
$visibleLink = $(this);
}
});
if ($visibleLink && $visibleLink.length) {
$(window).scrollTop($visibleLink.offset().top - extraHeight);
} else if (elPosition < extraHeight) {
$(window).scrollTop(elTop - extraHeight);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment