Scroll to top of thumbnail when contracting expanded image

This commit is contained in:
ahodesuka 2012-01-19 10:15:07 -06:00
parent 8f29d8eac9
commit efc557cb1d
2 changed files with 4 additions and 8 deletions

View File

@ -2995,12 +2995,8 @@
thumb = a.firstChild;
if (thumb.hidden) {
rect = a.getBoundingClientRect();
if (rect.top < 0) {
d.body.scrollTop += rect.top + thumb.height / (rect.height / rect.top * -1);
}
if (rect.left < 0) {
d.body.scrollLeft += rect.left + thumb.width / (rect.width / rect.left * -1);
}
if (rect.top < 0) d.body.scrollTop += rect.top;
if (rect.left < 0) d.body.scrollLeft += rect.left;
return imgExpand.contract(thumb);
} else {
return imgExpand.expand(thumb);

View File

@ -2317,8 +2317,8 @@ imgExpand =
thumb = a.firstChild
if thumb.hidden
rect = a.getBoundingClientRect()
d.body.scrollTop += rect.top + thumb.height / (rect.height / rect.top * -1) if rect.top < 0
d.body.scrollLeft += rect.left + thumb.width / (rect.width / rect.left * -1) if rect.left < 0
d.body.scrollTop += rect.top if rect.top < 0
d.body.scrollLeft += rect.left if rect.left < 0
imgExpand.contract thumb
else
imgExpand.expand thumb