March 11, 2012
Jumping to Position on page after Dynamic content added
Question by Cookiimonstar
I use ajax to dynamically add content to my site but i want the page to jump to the content has been added but i cant get i to work.
here is the link i am using to add the content and to jump the the position.
<a href="javascript:ajaxpage('/console/new_message_profile.php', 'message_area');" onclick="window.scrollTo(0, 2000);">
Answer by Starx
Give an id
to the dynamically generated element and then
$("#idofdynamicelement")[0].scrollIntoView( true );
// O to make sure its the first item if multiple found
// true to indicate the top position