锚点不适用于方法::由于某种原因发布。
我的视图文件index.haml:
.row#scroll-here
.col-md-12
= link_to "Get result", get_result_path(@book, :anchor => "scroll-here", parameters: {first: 1, second: 2}), method: :post, remote: true
_result_box.haml partial:
$('.results').html("<%= j (render partial: 'result_box') %>")
index.js.erb:
$odd = $even = [];
foreach (array_chunk($myArray, 2, true) as $pair) {
$odd += array_slice($pair, 0, 1, true);
$even += array_slice($pair, 1, 1, true);
}
asort($odd);
$result = [];
for ($i = 0; $i < count($odd); $i++) {
$result += array_slice($odd, $i, 1, true);
$result += array_slice($even, $i, 1, true);
}
按下link_to并重新加载“.results”后,页面焦点仍然位于页面顶部。但我希望它能在“滚动到这里”。
答案 0 :(得分:0)
试试这个
Action<DerivedObject1> x = do1 => Console.WriteLine(do1.SomeProperty);
SetMyAction<DerivedObject1>(x);
// Presumably there's *something* to invoke the action...
InvokeMyAction(new DerivedObject2());
或
= link_to "Get result", get_result_path(@book, :anchor => "scroll-here", parameters: {first: 1, second: 2}), method: :post,{ remote: true}
请参阅此链接(http://haml.info/docs/yardoc/file.REFERENCE.html#inserting_ruby_)
答案 1 :(得分:0)
<%=链接到“获取结果”,路径(id:params [:id]),类:“”,方法::post,远程:true%>