看板 Ajax 關於我們 聯絡資訊
function getTop(o) { var totalTop = 0; do { totalTop += o.offset().top; o = $(o.offsetParent()); } while (o !== $(document.body) && o !== $("html")[0]) return totalTop; } 不知道while要下什麼條件 試過加 o != null 或是 o.length > 0 都是進無限迴圈... -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 211.75.101.50 ※ 文章網址: https://www.ptt.cc/bbs/Ajax/M.1490177822.A.A2B.html
xw: 或許可以先log看一下o是什麼,是不是跟你想的一樣 03/22 23:45