开发者

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

开发者 https://www.devze.com 2022-12-18 05:33 出处:网络
render :update do |page| page.visual_effect :highlight, row_id, :duration => 20, :startcolor => \"#FFCC33\", :restorecolor =>\"\"
render :update do |page|
  page.visual_effect :highlight, row_id, :duration => 20, :startcolor => "#FFCC33", :restorecolor =>""
  page << "alert('hi');"
end

In the above code,开发者_JS百科 I have a highlight effect that occurs and lasts for 20 seconds, after the highlight effect completes, I want to have an alert popup. 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:

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

精彩评论

暂无评论...
验证码 换一张
取 消