简体   繁体   中英

jQuery (v1.5.2) offset.top not rendering correctly in IE 8

offset.left renders correctly but when trying to place an element below another one using offset.top , the element is showing up about 50px higher than the element it is supposed to be under. I've read various articles on stackoverflow that say to use offset.top , but doesn't seem to be working for me...

Discovered the issue...

I have a checkbox that "unhides" hidden spans that are on the page. When the page displays those spans, there is "header" span that provides instructions to the user. The offset.top is calculating based off of the original offset of the elements rather than using the offset that occurs when the hidden spans are revealed.

I was able to place the spans directly underneath their corresponding element by using... offset.top + headerHeight - heightOfOriginalElement + "px";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM