jquery - Follow scrollbar all the way down as DIV overflows? -
so have made script pushes text .txt document line per line @ different time stamps jquery. problem once div filled up, updates keep coming not visible unless visitor scrolls down. there way keep scollbar fixed @ bottom follows updates?
also it'd great addition randomize text pulled kaka.txt, doesn't go same order.
here script:
<div class="kaka" style="height: 200px; width: 300px;"> <?php include('kaka.txt'); ?> </div> <script type="text/javascript"> $(document).ready(function() { var pirmais = $('.kaka div:first-child'); pirmais.fadein().addclass('toms'); pirmais.next().addclass('sitais'); var kaka = function() { $('kaka div').not('.toms').hide(); var nakam = $('.sitais'); var pedejais = nakam.attr('pedejais'); if (pedejais == '1') { $('.kaka div').clone().appendto('.kaka').removeclass('toms').hide(); } else { } nakam.fadein().addclass('toms'); $('.kaka div').removeclass('sitais'); nekst = nakam.next().addclass('sitais'); }; (function loop() { var rand = math.round(math.random() * (3000 - 500)) + 500; settimeout(function() { kaka(); loop(); }, rand); }()); }); </script>
add following after nekst = nakam.next().addclass('sitais');
$('.kaka').animate({scrolltop: $('.kaka').attr('scrollheight')});
Comments
Post a Comment