如何将页面滚动到通过rjs插入的部分页面?
page.insert_html :bottom, :comments, :partial => 'comment', :object => @comment发布于 2010-04-28 19:45:28
您必须将javascript方法添加到页面并从控件中调用它。
例如:-在您的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}')"https://stackoverflow.com/questions/2728946
复制相似问题