javascript - Scrolling overflowed divs with ajax -


i know there similar posts, couldn't find single answer in of them has worked me. want new messages scroll bottom it's not doing it.

here's script show_messages.js:

i have div named 'show-messages' set overflow: auto

$(document).ready(function() {     // grab id html attribute     var uid = $('#message').attr('name');      setinterval(function() {         // load messages userid         $('#show-messages').load('show_messages.php?uid=' + uid);         $("#show-messages").scrolltop = $("#show-messages").scrollheight;      }, 500 ); }); 

does have ideas causing not scroll down?

scrolltop function of jquery objects calling property. however, scrollheight not, it's property on html element. access (first) html element jquery object, use $()[0].

also, should cal after load finishes

$('#show-messages').load('show_messages.php?uid=' + uid, function () {     $("#show-messages").scrolltop( $("#show-messages")[0].scrollheight ); }); 

Comments

Popular posts from this blog

php - Zend Framework / Skeleton-Application / Composer install issue -

c# - Better 64-bit byte array hash -

python - PyCharm Type error Message -