javascript - Issues with offsetTop when HTML margin is applied -
if set css
html { margin: 10px; border 10px solid #ccc; padding: 10px; } and try offsettop of element, possible convince browsers (ie , ch) not ignore document margin in calculation? firefox works expected reporting values according rendered html (uses 3 values).
is there fast cross-browser way of calculating offsettop when offsetparent body. unfortunately jquery's .offset() doesn't trick here :(
this code thinking , started.
the idea use htmlelement.getboundingclientrect() function that's supported major browser these days (and has been quite time now). difference i've found out when running against document.documentelement element. ff , chrome don't report bottom values according view port rather whole document itself.
so careful.
Comments
Post a Comment