diff --git a/public/src/forum/topic.js b/public/src/forum/topic.js index bfd423fedc..799451d60a 100644 --- a/public/src/forum/topic.js +++ b/public/src/forum/topic.js @@ -996,13 +996,13 @@ define(['composer'], function(composer) { return; } - var container = $(document.body), + var container = $(window), scrollTo = $('#post_anchor_' + pid), tid = $('#post-container').attr('data-tid'); function animateScroll() { - $('body,html').animate({ - scrollTop: scrollTo.offset().top - container.offset().top + container.scrollTop() - $('#header-menu').height() + $('window,html').animate({ + scrollTop: scrollTo.offset().top + container.scrollTop() - $('#header-menu').height() }, 400); } diff --git a/public/src/modules/chat.js b/public/src/modules/chat.js index 990b86b8fc..a8807615c8 100644 --- a/public/src/modules/chat.js +++ b/public/src/modules/chat.js @@ -58,6 +58,7 @@ define(['taskbar', 'string'], function(taskbar, S) { chatModal.attr('id', 'chat-modal-' + touid); chatModal.attr('UUID', uuid); + chatModal.css("position", "fixed"); chatModal.appendTo($('body')); chatModal.draggable({ start:function() { @@ -96,9 +97,10 @@ define(['taskbar', 'string'], function(taskbar, S) { } module.center = function(chatModal) { - chatModal.css("position", "fixed"); chatModal.css("left", Math.max(0, (($(window).width() - $(chatModal).outerWidth()) / 2) + $(window).scrollLeft()) + "px"); chatModal.css("top", "0px"); + chatModal.css("zIndex", 2000); + chatModal.find('#chat-message-input').focus(); return chatModal; } @@ -109,7 +111,6 @@ define(['taskbar', 'string'], function(taskbar, S) { checkOnlineStatus(chatModal); taskbar.updateActive(uuid); scrollToBottom(chatModal.find('#chat-content')); - chatModal.find('#chat-message-input').focus(); } module.minimize = function(uuid) { @@ -163,9 +164,11 @@ define(['taskbar', 'string'], function(taskbar, S) { }; function scrollToBottom(chatContent) { - chatContent.scrollTop( - chatContent[0].scrollHeight - chatContent.height() - ); + if(chatContent[0]) { + chatContent.scrollTop( + chatContent[0].scrollHeight - chatContent.height() + ); + } } module.toggleNew = function(uuid, state) {