Hi everyone I''m very new to Ruby on Rails and have just gotten a slideshow type application working. In one div there are all the images in the database and when you click it an AJAX call is made that makes the image appear in another div called "divProductDisplay". I have it all working with the AJAX and everything, but I can''t figure out how to get the visual effects working the way I want. I want the product to appear when an image is first clicked, and when another image is clicked I want the image to disappear and then have the image that was just clicked reappear.Here is what I have in the .rjs template right now: page.replace_html("divProductDisplay", :partial => "product_display") page.visual_effect(:toggle_appear, "divProductDisplay") This WORKS, but it will appear an image when clicked and then disappear the image when another is clicked. I don''t know how to write anything to get this working write as I am very knew to Rails and any back-end programming language. If you need any other information tell me what you need. Thanks for any help you can offer. -- 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 -~----------~----~----~----~------~----~------~--~---
Do you need any more information for this. -- 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 -~----------~----~----~----~------~----~------~--~---
On Mar 24, 7:47 pm, Paul Smith <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> page.replace_html("divProductDisplay", :partial => "product_display") > page.visual_effect(:toggle_appear, "divProductDisplay")I''m not an RJS expert myself yet, but, I don''t think toggle_appear is what you want. If I understand correctly, when an image is clicked: 1. The current image in divProductDisplay should fade away 2. The image in divProductDisplay should be replaced with the newly selected image 3. The new image should now appear I think part of the problem is your code is replacing the image, *then* toggling the appearance afterward, which isn''t right. So I think all you need to do is do another page.visual_effect :toggle_appear, ''divProductDisplay'' before you do your replace_html. Hope this helps, Jeff softiesonrails.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 -~----------~----~----~----~------~----~------~--~---
Hmm I tried it and it did the exact same thing anyone else with some suggestions? -- 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 -~----------~----~----~----~------~----~------~--~---