Footnotes resizing on subsequent clicks
-
I’ve come across a problem when the link to open a footnote is on the right side of its container, subsequent clicks on the footnote link result in the footnote popup to have it’s ‘left’ property set higher and higher, resulting in the footnote box having less and less width. To see this in action, check the above link, under the “How Unison HomeBuyer Works” section, under “In Return, Unison Invests Alongside You”, you should see footnote 1 (just after “30 years”) – clicking on it the first time looks fine, but if you click on it again to hide, and again to show again, you’ll see the popup now has less width. Keep doing this and the box gets narrower and narrower until it hits some minimum width.
I did some investigation on a local installation of this site, and I found that when it tries to calculate footnoteWidth (in the on click listener), the width it calculates on the 2nd click ends up being the width of the box when it showed after the first click and not the max-width of 300px, due to the fact that it has its ‘left’ property set such that the box has less than 300px of width. Then, on the 3rd click, the footnoteWidth ends up being the width the box showed after the 2nd click, etc.
I was able to fix this by modifying the modern_footnotes_hide_footnotes function to remove the ‘left’ and ‘top’ css properties from ‘.modern-footnotes-footnote__note’. Change:
jQuery(“.modern-footnotes-footnote__note”).hide()
to:
jQuery(“.modern-footnotes-footnote__note”).hide().css({‘left’: ”, ‘top’: ”});This results in footnoteWidth always being calculated at its max width, regardless of where it is currently placed (on subsequent clicks), and the box shows in the same place (at the same width) on subsequent clicks.
Would love to hear your thoughts.
The page I need help with: [log in to see the link]
- The topic ‘Footnotes resizing on subsequent clicks’ is closed to new replies.