开发者

multiple visual effects on one event

开发者 https://www.devze.com 2022-12-30 08:33 出处:网络
I have a code that looks like this. <%= link_to_remote \"View results\", { :update=>\"uxUpdateDiv\" ,

I have a code that looks like this.

<%= link_to_remote "View results",
{
    :update=>"uxUpdateDiv" ,
    :url=>{:controller=>"exam", :action=>"results"}  ,
    :loading=>visual_effect(:appear, "uxcLoader", :duration=> 0.1),
    :before =>visual_effect(:fade, "uxUpdateDiv", :duration => 0.1),
    :complete => visual_effect(:appear, "uxUpdateDiv", :duration => 1.5 ),
    :success=>visual_effect(:fade, "uxcLoader", :duration=> 1)
}
%>

what happens here is not good enough for me.

I want to add multiple effects for one event. Like the following:

 :complete=>(:fade, "uxLoader", :duration=>1 AND :fade, "uxTheOtherDiv", :duration=>1)

开发者_运维问答How do i achieve this.? I am using jrails


You can write like this:

:complete=>update_page do |page|
            page.visual_effect :fade, "uxLoader", :duration=>1
            page.visual_effect :fade, "uxTheOtherDiv", :duration=>1
           end

See the api.


Using straight jQuery?

:complete => "$('uxLoader').fadeIn(1000); $('uxTheOtherDiv').fadeIn(1000);"
0

精彩评论

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

关注公众号