I have a scroll to function that I need to execute to scroll to the last message in its container, which is the container with chunk_id. The problem is that it works as is for going to the container, but if I add last-child into the mix the function does not work. Any ideas what I am doing wrong?
Works
$.scrollTo('div[chunk_id="'+autoscroll+'"]', 800, {easing:'elasout',offset:-250} );
Does not
$.scrollTo('div[chunk_id="'+autoscroll+'"]:last-child', 800, {easing:'elasout',offset:-250} );
I think you want to find the last child element of the
div. Your code is currently selecting the lastdivwith a particularchunk_idthat is also the last child of its parent. This may well not exist.You should use the child selector
>combined with:last-childto find the last child element of the element already selected: