visual_effect with a delay
One of the coolest things I ran across in RJS was the delay method. This delay method will do just that and delay a number of seconds. So lets say you need to highlight something that was just added to the page after the user submits it. I would like it to add to the page then wait 1 second and then highlight. The following is the code for that.
[ruby]
render :update do |page|
page.html_replace ‘testdiv’, params[:the_text_added]
page.delay(1) do
page.visual_effect :highlight, ‘testdiv’, :duration => 2
end
end
[/ruby]
Cool huh? Try it out and see what you can do with delay()!
Categories
Pages
- contact
- Contact Form V1.8
- FlickrHelper
- Guestbook V1.01 ASP
- Guestbook V2.4.7
- iFrame Loader
- Scriptatype:PHP
- Winn Cal
- Winn Tracker
