Merge pull request #120 from ahodesuka/master
Fix scroll offset when contracting images, #104
This commit is contained in:
commit
d3806e293f
@ -2991,9 +2991,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
toggle: function(a) {
|
toggle: function(a) {
|
||||||
var thumb;
|
var rect, thumb;
|
||||||
thumb = a.firstChild;
|
thumb = a.firstChild;
|
||||||
if (thumb.hidden) {
|
if (thumb.hidden) {
|
||||||
|
rect = a.parentNode.getBoundingClientRect();
|
||||||
|
if (rect.top < 0) d.body.scrollTop += rect.top;
|
||||||
|
if (rect.left < 0) d.body.scrollLeft += rect.left;
|
||||||
return imgExpand.contract(thumb);
|
return imgExpand.contract(thumb);
|
||||||
} else {
|
} else {
|
||||||
return imgExpand.expand(thumb);
|
return imgExpand.expand(thumb);
|
||||||
|
|||||||
@ -2316,6 +2316,9 @@ imgExpand =
|
|||||||
toggle: (a) ->
|
toggle: (a) ->
|
||||||
thumb = a.firstChild
|
thumb = a.firstChild
|
||||||
if thumb.hidden
|
if thumb.hidden
|
||||||
|
rect = a.parentNode.getBoundingClientRect()
|
||||||
|
d.body.scrollTop += rect.top if rect.top < 0
|
||||||
|
d.body.scrollLeft += rect.left if rect.left < 0
|
||||||
imgExpand.contract thumb
|
imgExpand.contract thumb
|
||||||
else
|
else
|
||||||
imgExpand.expand thumb
|
imgExpand.expand thumb
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user