mirror of
https://github.com/zulip/zulip.git
synced 2026-06-24 21:08:25 +08:00
help: Fix broken anchor link scrolling in documentation pages.
Whenever a link is clicked, the page link changes, and the content of the `.markdown .content` node updates, preventing the old listener to catch any future anchor link clicks. We attach the listener to the document instead and only activate it when the target element is a proper anchor link heading. Fixes #9767.
This commit is contained in:
parent
3dd9f61851
commit
dcfc2e10b8
@ -178,8 +178,8 @@ function scrollToHash(container) {
|
||||
$('.help .sidebar h1, .help .sidebar h2, .help .sidebar h3').removeAttr('id');
|
||||
|
||||
// Scroll to anchor link when clicked
|
||||
$('.markdown .content h1, .markdown .content h2, .markdown .content h3').on('click', function () {
|
||||
window.location.href = window.location.href.replace(/#.*/, '') + '#' + $(this).attr("id");
|
||||
$(document).on('click', '.markdown .content h1, .markdown .content h2, .markdown .content h3', function () {
|
||||
location.hash = $(this).attr("id");
|
||||
});
|
||||
|
||||
$(".hamburger").click(function () {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user