javascript - DIV Element Not Scrolling -
javascript - DIV Element Not Scrolling -
take @ this.
sign in random username , start spamming chat till bottom of div. notice how doesn't scroll? need figure out why.
javascript code used scrolling:
// note: chatbox_id = "#chat" minte.ui.addchatentry = function(html) { // add together chat entry... var entry = '<div>' + this.formatstring(html) + '</div>'; $(chatbox_id).html($(chatbox_id).html() + entry); // .. scroll downwards bottom var chatcontentheight = 0; var chatheight = $(chatbox_id).height(); $(chatbox_id + " > div").each(function() { chatcontentheight += $(this).outerheight(); }); if (chatcontentheight > chatheight) { var scroll = chatcontentheight - chatheight; $(chatbox_id).scrolltop(scroll); } }; *and here css #chat: *
chat { position: absolute; left: 0%; top: 0%; width: 65%; height: 100%; text-align: left; overflow-y: scroll; overflow-x: hide; word-wrap: break-word; } i have feeling it's happening because #chat absolutely positioned, don't know why exactly. html code rather long didn't post here, on page linked view view source.
i have spent much time trying prepare problem no avail. guys can help me solve mysterious problem.
the .scrollheight property on #chat element want.
$(chatbox_id).scrolltop($(chatbox_id)[0].scrollheight) javascript html css scroll
Comments
Post a Comment