only scroll images into view when expanded if they are individually clicked
This commit is contained in:
parent
7bdd8a31e1
commit
34c34df5a8
@ -84,6 +84,7 @@ ImageExpand =
|
|||||||
|
|
||||||
toggle: (post) ->
|
toggle: (post) ->
|
||||||
unless post.file.isExpanding or post.file.isExpanded
|
unless post.file.isExpanding or post.file.isExpanded
|
||||||
|
post.file.scrollIntoView = true
|
||||||
ImageExpand.expand post
|
ImageExpand.expand post
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -116,7 +117,7 @@ ImageExpand =
|
|||||||
$.rmClass post.nodes.root, 'expanded-image'
|
$.rmClass post.nodes.root, 'expanded-image'
|
||||||
$.rmClass file.thumb, 'expanding'
|
$.rmClass file.thumb, 'expanding'
|
||||||
$.rm file.videoControls if file.videoControls
|
$.rm file.videoControls if file.videoControls
|
||||||
for x in ['isExpanding', 'isExpanded', 'videoControls', 'wasPlaying']
|
for x in ['isExpanding', 'isExpanded', 'videoControls', 'wasPlaying', 'scrollIntoView']
|
||||||
delete file[x]
|
delete file[x]
|
||||||
if el = file.fullImage
|
if el = file.fullImage
|
||||||
$.off el, 'error', ImageExpand.error
|
$.off el, 'error', ImageExpand.error
|
||||||
@ -183,9 +184,11 @@ ImageExpand =
|
|||||||
window.scrollBy 0, bottom - oldBottom
|
window.scrollBy 0, bottom - oldBottom
|
||||||
|
|
||||||
# Scroll to display full image.
|
# Scroll to display full image.
|
||||||
imageBottom = Header.getBottomOf file.fullImage
|
if file.scrollIntoView
|
||||||
if imageBottom + height >= 0 and imageBottom < 0
|
delete file.scrollIntoView
|
||||||
window.scrollBy 0, Math.min(-imageBottom, Header.getTopOf file.fullImage)
|
imageBottom = Header.getBottomOf file.fullImage
|
||||||
|
if imageBottom + height >= 0 and imageBottom < 0
|
||||||
|
window.scrollBy 0, Math.min(-imageBottom, Header.getTopOf file.fullImage)
|
||||||
|
|
||||||
if file.isVideo
|
if file.isVideo
|
||||||
ImageExpand.play post if Conf['Autoplay']
|
ImageExpand.play post if Conf['Autoplay']
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user