scroll so that full image/video is on screen after expansion

This commit is contained in:
ccd0 2014-07-26 23:57:13 -07:00
parent eee835fec7
commit 8e2f9167fb

View File

@ -178,6 +178,12 @@ ImageExpand =
# Scroll to keep our place in the thread when images are expanded above us.
if oldBottom? and oldBottom <= 0
window.scrollBy 0, post.nodes.root.getBoundingClientRect().bottom - oldBottom
return
# Scroll to display full image.
imageBottom = Header.getBottomOf file.fullImage
if imageBottom < 0
window.scrollBy 0, Math.min(-imageBottom, Header.getTopOf file.fullImage)
play: (post) ->
if !d.hidden and Header.isNodeVisible post.file.fullImage