How can I scroll the page to a partial, which got inserted via rjs?
page.insert_html :bottom, :comments, :partial => 'comment', :object => @comment
How can I scroll the page to a partial, which got inserted via rjs?
page.insert_html :bottom, :comments, :partial => 'comment', :object => @comment
You have to add a javascript method to your page and call it from your controler
for ex:- In your example.html.erb
function scrollToDiv(id){
// This method is used to scroll page
}
And in your controller method
page.insert_html :bottom, :comments, :partial => 'comment', :object => @comment
page << "scrollToDiv('#{@comment.id}')"