distillpub / template

This is the repository for the distill web framework
http://distill.pub/guide/
Apache License 2.0
810 stars 133 forks source link

Fix offset calculation in hover box. #105

Open All-less opened 5 years ago

All-less commented 5 years ago

Currently, the offset of a hover box is calculated based on offsetLeft and offsetTop. However, both attributes are relative to the parent, so the citations and footnotes in a table (or other nested elements) may be placed incorrectly.

original

This patch calculates the offset by recursively adding up the offsets of parents. Now the hover boxes appear at the right place.

fixed

colah commented 5 years ago

Gosh! Thank you for the lovely PR. GIFs in the description is lovely.

I'll defer to @ludwigschubert on code review, just wanted to comment because you'd handled that so nicely. :)