Merge pull request #1298 from thelounge/xpaw/fix-toggle-scroll

Fix jumps when toggling link preview
This commit is contained in:
Pavel Djundik 2017-07-04 21:00:56 +03:00 committed by GitHub
commit fc231bca76
1 changed files with 2 additions and 2 deletions

View File

@ -9,7 +9,7 @@ socket.on("msg:preview", function(data) {
data.preview.shown = options.shouldOpenMessagePreview(data.preview.type); data.preview.shown = options.shouldOpenMessagePreview(data.preview.type);
const msg = $("#msg-" + data.id); const msg = $("#msg-" + data.id);
const container = msg.parent(".messages"); const container = msg.closest(".chat");
const bottom = container.isScrollBottom(); const bottom = container.isScrollBottom();
msg.find(".text").append(templates.msg_preview({preview: data.preview})); msg.find(".text").append(templates.msg_preview({preview: data.preview}));
@ -23,7 +23,7 @@ socket.on("msg:preview", function(data) {
$("#chat").on("click", ".toggle-button", function() { $("#chat").on("click", ".toggle-button", function() {
const self = $(this); const self = $(this);
const container = self.closest(".messages"); const container = self.closest(".chat");
const content = self.parent().next(".toggle-content"); const content = self.parent().next(".toggle-content");
const bottom = container.isScrollBottom(); const bottom = container.isScrollBottom();