Skip to content

Should hide the tooltip on page resize as well #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions _js/custom/navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ $(function () {
// Try to scroll to a giben anchor, if any
if (anchorId)
scrollToAnchor(anchorId);
// Clear any focus (e.g back navigation keeps the previously clicked link focused)
window.trigger('blur');
}

function updateContentFromUrl(url) {
Expand Down Expand Up @@ -709,6 +711,11 @@ $(function () {
elementUnderCursor = event.target;
});

window.addEventListener('resize', function () {
if (tooltipTarget)
hideTooltip(true);
});

window.addEventListener('blur', function () {
if (tooltipTarget)
hideTooltip(true);
Expand Down
4 changes: 4 additions & 0 deletions _js/main.min.js
Original file line number Diff line number Diff line change
Expand Up @@ -8539,6 +8539,7 @@ $(function() {
if (ClipboardJS.isSupported()) addCodeBlocksTitle();
addContentTooltips();
if (anchorId) scrollToAnchor(anchorId);
window.trigger("blur");
}
function updateContentFromUrl(url) {
var currContent = document.querySelector(contentID);
Expand Down Expand Up @@ -8876,6 +8877,9 @@ $(function() {
document.addEventListener("mouseover", function(event) {
elementUnderCursor = event.target;
});
window.addEventListener("resize", function() {
if (tooltipTarget) hideTooltip(true);
});
window.addEventListener("blur", function() {
if (tooltipTarget) hideTooltip(true);
});
Expand Down
4 changes: 2 additions & 2 deletions _plugins/generate_tooltips.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def make_tooltip(page, page_links, id, url, match)
link_data = page_links[id]
if link_data != nil
url = link_data["url"]
url = prefixed_url(url, page.site.config["baseurl"])
url = prefixed_url(url, page.site.config["baseurl"])
else
puts "Error: Unknown ID in matching part: #{match_parts}"
return match
Expand Down Expand Up @@ -309,7 +309,7 @@ def gen_page_link_data(links_dir, link_files_pattern)

page_link_data = page_links_dictionary[alias_id]
if page_link_data == nil
puts "Error: Unknow ID (#{alias_id}) in alias definition"
puts "Error: Unknown ID (#{alias_id}) in alias definition"
exit 4
end
page_link_data["title"].concat(alias_data["aliases"])
Expand Down