Calculate offset between html
and body
elements
#491
Comments
May also be related to Issue #423. |
FWIW, I can confirm that we implemented the change on our site and it works as expected now. I just don't know if the change would have side-effects on other page layouts or not. |
If body has margins and position:relative (for absolute items in it) - swf has wrong position. @JamesMGreene, is there any possible quick fix ? |
@vladshcherbin The code in that fiddle is minified, but from glancing at it, it appears that it doesn't include the fix I've been referring to. Try adding the fix in and see if it resolves. |
@sporkmonger the code is minified 2.1.6, without any fixes |
https://github.com/bitpesa/zeroclipboard-rails/commit/63c6ec3034d5352c45073b1ec025c6af7ca63adf We're using zeroclipboard/zeroclipboard-rails, so we forked that and implemented our fix there even though, if it works, the code should ultimately live in the upstream project. |
@sporkmonger thanks, it finally works. |
OK, great, independent confirmation! Anybody want to chime in and confirm that the code doesn't break sites that were already working? That's actually the detail I'm more worried about. |
Ditto to that worry! 😛 |
Related: #495 ("Create positioning unit tests") |
@sporkmonger Your fix works great on version 2.1.6. Thanks! |
Yeah, I'll try to get this and a few other fixes rolled into a |
From a commit comment, @sporkmonger suggested we factor in the use of
document.body.getBoundingClientRect()
anddocument.documentElement.getBoundingClientRect()
to calculate the top/left offsets between thehtml
andbody
elements, if any, within the_getDOMObjectPosition
internal function:The text was updated successfully, but these errors were encountered: