O
O
ObehanProger2020-04-19 17:24:31
css
ObehanProger, 2020-04-19 17:24:31

How to set up a scroll wheel when loading data via ajax?

There is a block container for chat:
<div id="message_block"></div>

#message_block{
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  overflow-y:scroll;
}

in which messages are loaded as they are added via ajax. Here is a function that outputs messages to this block:
function (result)
                 {
          	if(result){
          		var html_data='<p>';
            	$.each(result,function(index,value){
            		html_data+=value.message+'</p><p>';
            	});
            	html_data+='</p>';
            	$('#message_block').html(html_data).css('overflow-y','scroll');
          	}

Despite the property being set overflow-y:scrollfor the main block, the message scroll wheel does not appear. There is a strip, but there is no wheel in it. And older messages are not visible or scrollable. How to fix?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Arseny, 2020-04-19
Matytsyn @ArsenyMatytsyn

Mmm... overflow-y: auto?
Yes, by the way, in combination with justify-content: flex-end;it crookedly works.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question