I have a refresh function that is set to refresh on a time interval. There is a function within that function called scrollTo which scrolls to the last element of the box. The problem is that elements are constantly being added to the box so without the use of ‘live’ the scrollTo will find a div and stick to it instead of finding the new last-child and scrolling to it on refresh. Which function should I apply live to, the refresh() or the ScrollTo and I always see live with a click event, can you attach it in a different way?
function refresh() {
$.scrollTo('div[chunk_id="'+autoscroll+'"] > :last-child', 800, {easing:'elasout',offset:-250} );
}
would this do the same?:
I don’t think it will since you are explicitly creating a scoped variable. It should recalculate that value on each run of the function.