fix chat scroll, luke ist dafür verantwortlich
This commit is contained in:
@@ -23,7 +23,8 @@ function enableChatInput(enable) {
|
|||||||
if (enable) {
|
if (enable) {
|
||||||
chat.input = $("#chat").append('<div><input id="chat_msg" type="text" /></div>').children(":last");
|
chat.input = $("#chat").append('<div><input id="chat_msg" type="text" /></div>').children(":last");
|
||||||
chat.input.children("input").focus();
|
chat.input.children("input").focus();
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
chat.input.fadeOut('fast', function () {
|
chat.input.fadeOut('fast', function () {
|
||||||
chat.input.remove();
|
chat.input.remove();
|
||||||
chat.input = null;
|
chat.input = null;
|
||||||
@@ -64,14 +65,12 @@ var chatAPI =
|
|||||||
var today = new Date();
|
var today = new Date();
|
||||||
|
|
||||||
if (chatElement === "<li></li>") {
|
if (chatElement === "<li></li>") {
|
||||||
var time = today.toLocaleTimeString('de-DE');
|
|
||||||
chat.container.append("<li>" + "[" + time + "] " + text + "</li>");
|
|
||||||
|
|
||||||
if (chat.input == null || elmnt.scrollTop == elmnt.scrollHeight - elmnt.clientHeight) {
|
if (chat.input == null || elmnt.scrollTop == elmnt.scrollHeight - elmnt.clientHeight) {
|
||||||
|
chat.container.append("<li>" + "[" + today.toLocaleTimeString('de-DE') + "] " + text + "</li>");
|
||||||
elmnt.scrollTop = elmnt.scrollHeight - elmnt.clientHeight;
|
elmnt.scrollTop = elmnt.scrollHeight - elmnt.clientHeight;
|
||||||
|
} else {
|
||||||
|
chat.container.append("<li>" + "[" + today.toLocaleTimeString('de-DE') + "] " + text + "</li>");
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (!chat.enabled) { elmnt.scrollTo(0, elmnt.scrollHeight); }
|
|
||||||
} else {
|
} else {
|
||||||
chat.container.append(chatElement);
|
chat.container.append(chatElement);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user