简体   繁体   English

特殊的高光效果之后,我该如何处理?

[英]How do I have something happen *after* the scriptaculous highlight effect

render :update do |page|
  page.visual_effect :highlight, row_id, :duration => 20, :startcolor => "#FFCC33", :restorecolor =>""
  page << "alert('hi');"
end

In the above code, I have a highlight effect that occurs and lasts for 20 seconds, after the highlight effect completes, I want to have an alert popup. 在上面的代码中,我有一个突出显示效果,持续20秒,突出显示效果完成后,我想弹出一个警报。 Currently, the alert immediately pops up without waiting for the highlight effect to complete. 当前,警报立即弹出,而无需等待突出显示效果完成。

This should work for you: 这应该为您工作:

render :update do |page|
  page.visual_effect :highlight, row_id, :afterfinish => "alert('hi')", :duration => 20, :startcolor => "#FFCC33", :restorecolor =>""
end

In pure JavaScript code, this effect can be applied as follows: 在纯JavaScript代码中,可以按以下方式应用此效果:

$('element_id').highlight({
    duration:20,
    startcolor: "FFCC33",
    afterFinish:function(){
        // do whatever you want
    }
})

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM