aNgeLyN omar
aNgeLyN omar

Reputation: 43

Auto-scroll to bottom and then disable after successful auto-scrolling

I want to allow auto-scrolling to bottom on loading the div then disable that function afterwards how can I possible do that

//$("#chatroom").animate({ scrollTop: $(document).height() }, "slow");
var scrolled = 0;
$("#chatroom").animate({
    scrollTop: $('#chatroom')[0].scrollHeight
}, 1000)

scrolled = 1;
$('#closechat').live('click', function () {
    $('#chatroom').hide();
    stoprefresh();
}); 

Upvotes: 0

Views: 217

Answers (1)

yeyene
yeyene

Reputation: 7380

Check this out... http://jsfiddle.net/reWwx/227/

You can change bottom value as you like.

JQUERY

$(document).ready(function(){
   var bodyHeight = $('body').height();
   var footerOffsetTop = $('#line-three').offset().top;
   var topToBottom = bodyHeight -footerOffsetTop;
    
  $('#line-three').css({top:'auto',bottom:topToBottom});
  $("#line-three").delay(100).animate({
    bottom: '50px',
    }, 1200, function() {
     $('#line-three').hide(500);      
  });  
})

Upvotes: 1

Related Questions