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

c# - Better 64-bit byte array hash -

webrtc - Which ICE candidate am I using and why? -

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