0
如何将页面滚动到部分,通过rjs插入?如何用rjs滚动页面?
page.insert_html :bottom, :comments, :partial => 'comment', :object => @comment
如何将页面滚动到部分,通过rjs插入?如何用rjs滚动页面?
page.insert_html :bottom, :comments, :partial => 'comment', :object => @comment
你有一个JavaScript方法添加到您的网页,并从CONTROLER
称其为前: - 在你example.html.erb
function scrollToDiv(id){
// This method is used to scroll page
}
而在你的控制器方法
page.insert_html :bottom, :comments, :partial => 'comment', :object => @comment
page << "scrollToDiv('#{@comment.id}')"