I need to do let the last reply scroll into view using jQuery. Here is my code:
function showHideReplies(replies){
replies.each(function() {
if($(this).index() < nIniRep || afterReply){
$(this).show();
if(afterReply && $(this).index()==replies.length ){
$(this).scrollIntoView();
}
}else{
$(this).hide();
}
});
}
afterReply
was defined in my JavaScript.
My question is: I know scrollIntoView()
is an HTML DOM Method, and you can use it like this:
var elmnt = document.getElementById("content");
elmnt.scrollIntoView();
But I need to use with jQuery, and I think it should work the same way. But it doesn't work with the jQuery syntax $(this).scrollIntoView();
How do I use scrollIntoView()
under jQuery syntax?
Thank you.