Use getBoundingClientRect and body.clientHeight for offset fix
This commit is contained in:
parent
7a2343f6c5
commit
9baddbc771
@ -2991,16 +2991,11 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggle: function(a) {
|
toggle: function(a) {
|
||||||
var el, thumb, top;
|
var thumb, top;
|
||||||
thumb = a.firstChild;
|
thumb = a.firstChild;
|
||||||
if (thumb.hidden) {
|
if (thumb.hidden) {
|
||||||
if (thumb.nextSibling.offsetHeight > window.innerHeight) {
|
if (thumb.nextSibling.offsetHeight > d.body.clientHeight && (top = a.getBoundingClientRect().top) < 0) {
|
||||||
el = thumb.nextSibling;
|
window.scroll(window.scrollX, window.scrollY + top);
|
||||||
top = el.offsetTop;
|
|
||||||
while (el = el.offsetParent) {
|
|
||||||
top += el.offsetTop;
|
|
||||||
}
|
|
||||||
if (top < window.scrollY) window.scroll(window.scrollX, top);
|
|
||||||
}
|
}
|
||||||
return imgExpand.contract(thumb);
|
return imgExpand.contract(thumb);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -2316,12 +2316,8 @@ imgExpand =
|
|||||||
toggle: (a) ->
|
toggle: (a) ->
|
||||||
thumb = a.firstChild
|
thumb = a.firstChild
|
||||||
if thumb.hidden
|
if thumb.hidden
|
||||||
if thumb.nextSibling.offsetHeight > window.innerHeight
|
if thumb.nextSibling.offsetHeight > d.body.clientHeight and (top = a.getBoundingClientRect().top) < 0
|
||||||
el = thumb.nextSibling
|
window.scroll window.scrollX, window.scrollY + top
|
||||||
top = el.offsetTop
|
|
||||||
while el = el.offsetParent
|
|
||||||
top += el.offsetTop
|
|
||||||
window.scroll window.scrollX, top if top < window.scrollY
|
|
||||||
imgExpand.contract thumb
|
imgExpand.contract thumb
|
||||||
else
|
else
|
||||||
imgExpand.expand thumb
|
imgExpand.expand thumb
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user