.rjs template newbie help

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.

Do you need any more information for this.

On Mar 24, 7:47 pm, Paul S. [email protected]

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,

Hmm I tried it and it did the exact same thing anyone else with some