Don't scroll out visible posts when invisible images get expanded. Close #938
This commit is contained in:
parent
737097e46a
commit
3abff121ee
@ -4543,13 +4543,15 @@
|
|||||||
return $.after(thumb, img);
|
return $.after(thumb, img);
|
||||||
},
|
},
|
||||||
completeExpand: function(post) {
|
completeExpand: function(post) {
|
||||||
var thumb;
|
var rect, root, thumb;
|
||||||
thumb = post.file.thumb;
|
thumb = post.file.thumb;
|
||||||
if (!$.hasClass(thumb, 'expanding')) {
|
rect = post.nodes.root.getBoundingClientRect();
|
||||||
return;
|
|
||||||
}
|
|
||||||
$.addClass(post.nodes.root, 'expanded-image');
|
$.addClass(post.nodes.root, 'expanded-image');
|
||||||
$.rmClass(thumb, 'expanding');
|
$.rmClass(post.file.thumb, 'expanding');
|
||||||
|
if (rect.top + rect.height <= 0) {
|
||||||
|
root = $.engine === 'webkit' ? d.body : doc;
|
||||||
|
root.scrollTop += post.nodes.root.clientHeight - rect.height;
|
||||||
|
}
|
||||||
return post.file.isExpanded = true;
|
return post.file.isExpanded = true;
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
|
|||||||
@ -3023,9 +3023,15 @@ ImageExpand =
|
|||||||
|
|
||||||
completeExpand: (post) ->
|
completeExpand: (post) ->
|
||||||
{thumb} = post.file
|
{thumb} = post.file
|
||||||
return unless $.hasClass thumb, 'expanding'
|
rect = post.nodes.root.getBoundingClientRect()
|
||||||
$.addClass post.nodes.root, 'expanded-image'
|
$.addClass post.nodes.root, 'expanded-image'
|
||||||
$.rmClass thumb, 'expanding'
|
$.rmClass post.file.thumb, 'expanding'
|
||||||
|
if rect.top + rect.height <= 0
|
||||||
|
root = if $.engine is 'webkit'
|
||||||
|
d.body
|
||||||
|
else
|
||||||
|
doc
|
||||||
|
root.scrollTop += post.nodes.root.clientHeight - rect.height
|
||||||
post.file.isExpanded = true
|
post.file.isExpanded = true
|
||||||
|
|
||||||
error: ->
|
error: ->
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user