Adding a tooltip to links on hover?
I love the hover preview used in the bigfoot footnotes within the magazine theme. Just wondering if there was a way to do similar when hovering over wikilinks (similar to that of wikipedia or obsidian)?
This feature is not built into any of Blot's templates by default. However, if you're willing to write some JavaScript, you can add this functionality to your own template.
In general, my approach to solve this problem would be:
- Add an handler to each
<a>
tag in your post for the mouseover event - On mouseover issue a HTTP request using XMLHttpRequest to the
<a>
tag'shref
attribute, appending the query string&json=true
to receive the post's structured data. - Parse the JSON for the linked post and then use its
title
andteaser
properties to render your popover tooltip preview above the original<a>
Please let me know if you have any questions about this or anything else
Answered 2 years ago · Edit answer