[jQuery] Re: Getting a div with scroll bar to stay scrolled down
> Nope, I was utilizing the scrollTop() method from dimensions. Okay, the next time I think you made a mistake I'll rethink it a bit. :)
[jQuery] Re: Getting a div with scroll bar to stay scrolled down
On 10/19/07, Dave Methvin <[EMAIL PROTECTED]> wrote: > > > > $('#divname').scrollTop( $('#divname')[0].scrollHeight ); > > I think you meant: > > $('#divname')[0].scrollTop( $('#divname')[0].scrollHeight ); Nope, I was utilizing the scrollTop() method from dimensions. Here's another way that avoids redundant selector expressions: > > $('#divname').each(function(){this.scrollTop = this.scrollHeight}); > >
[jQuery] Re: Getting a div with scroll bar to stay scrolled down
> $('#divname').scrollTop( $('#divname')[0].scrollHeight ); I think you meant: $('#divname')[0].scrollTop( $('#divname')[0].scrollHeight ); Here's another way that avoids redundant selector expressions: $('#divname').each(function(){this.scrollTop = this.scrollHeight});
[jQuery] Re: Getting a div with scroll bar to stay scrolled down
I think that would be how prototype would do it. Here's how jQuery would: $('#divname').scrollTop( $('#divname')[0].scrollHeight ); Cheers, -js On 10/16/07, Eric <[EMAIL PROTECTED]> wrote: > > > Hi all, > > I have a div that will refresh itself and the scroll bar just won't > stay down. The solution I've found is: > >var objDiv = document.getElementById("divname"); >objDiv.scrollTop = objDiv.scrollHeight; > > This doesn't work: > $('#divname').scrollTop = $('#divname').scrollHeight; > > Therefore is there a more jquery-like way of doing it other than using > plugins perhaps? > > Thanks. > > Eric > >
[jQuery] Re: Getting a div with scroll bar to stay scrolled down
I think this should work in the latest version of jQuery. $('html').animate({ scrollTop: $('html').height() }); On Oct 17, 5:18 am, Eric <[EMAIL PROTECTED]> wrote: > Hi all, > > I have a div that will refresh itself and the scroll bar just won't > stay down. The solution I've found is: > > var objDiv = document.getElementById("divname"); > objDiv.scrollTop = objDiv.scrollHeight; > > This doesn't work: > $('#divname').scrollTop = $('#divname').scrollHeight; > > Therefore is there a more jquery-like way of doing it other than using > plugins perhaps? > > Thanks. > > Eric