I'm prepending the markup retur开发者_开发百科ned after an jquery ajax() call [the success part of the code as below]
success: function(html){
$("ul#lists").prepend(html);
$("ul#lists li:first").fadeIn("slow");
}
When the prepend is success, I want the page to automatically scroll to the position where the prepend is happening. I'm not sure of the syntax but the following is something like what I want.
success: function(html){
if($("ul#lists").prepend(html)) {
//Scroll to the position in the page where the prepend is about to happen
//something similar to the href="#bookmark' in html.
}
$("ul#lists li:first").fadeIn("slow");
}
So how do I do that?
You can use this plugin by Ariel Flesler.
Hi u can use this , were id is element id where page has to be scrolled.
$('html, body').animate({scrollTop: $("#"+id).offset().top}, 2000);
Keep laughing.
精彩评论