Hi. I need help on what is essentially putting an "onload" event handler into a div. I am using render :partial and when the partial is loaded, I would like the divs to show using an effect from a library such as scriptaculous or moofx. However, there is no "onload" for a div. I was wondering what alternative methods I should use to achieve this. Thanks! -- Posted via http://www.ruby-forum.com/.
Dave wrote:> Hi. I need help on what is essentially putting an "onload" event handler > into a div. I am using render :partial and when the partial is loaded, I > would like the divs to show using an effect from a library such as > scriptaculous or moofx. However, there is no "onload" for a div. I was > wondering what alternative methods I should use to achieve this. > > Thanks!I''m wondering about this meself. Does anyone have ideas on this? I have the effect working if I do "onClick", but how can I get the effect to work with "onLoad" for a div? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Dave wrote:> Hi. I need help on what is essentially putting an "onload" event handler > into a div. I am using render :partial and when the partial is loaded, I > would like the divs to show using an effect from a library such as > scriptaculous or moofx. However, there is no "onload" for a div. I was > wondering what alternative methods I should use to achieve this. > > Thanks!If you put the j-script you want to execute in a <script></script> block that appears immediately after the div, and have the script execute immediately, then it will only run immediately after the div is in place. E.g.: <div> content content content </div> <script type="text/javascript"> function do_something_to_div() { ... } do_something_to_div(); </script> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
here''s an example: this is in an RJS file called create.rjs: page.visual_effect :blind_up, "new_comment_form_for_post_#{@post.id}" this is called from the create action of a controller....in the create action would be something like this: respond_to do |format| format.js end which would call the RJS...the RJS does the scriptaculous effect that makes the div roll up like a blind....the div id is in the speech marks after the :blind_up command..... further reading: http://script.aculo.us -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---