# Two RJS/AJAX problems

**URL:** <https://www.ruby-forum.com/t/two-rjs-ajax-problems/115332>\
**Category:** Rails\
**Created:** [September 24, 2007, 4:38am UTC](https://www.ruby-forum.com/t/two-rjs-ajax-problems/115332 "2007-09-24T04:38:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nemesis256](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ba9def/32.png) [@nemesis256](https://www.ruby-forum.com/u/nemesis256)\
**Post date:** [September 24, 2007, 4:38am UTC](https://www.ruby-forum.com/t/two-rjs-ajax-problems/115332/1 "2007-09-24T04:38:34Z")

</div>

So I’m making this photo gallery, which is almost done except for  
these two problems. I have 6 thumbnails on the left side of the page,  
paginated, with some AJAX. On right of those is the full sized  
image. Now for the problems. This is my .rjs file:

page[:fullImages].visual\_effect :fade  
page.delay(1) do  
page.replace\_html(“fullImages”, :partial =\> “image”, :object =\>  
@image)  
page[:fullImages].visual\_effect :appear  
end

1. In firefox, this effect works once for the first thumbnail image.  
But after that, the thumbnails are not linked anymore (regular cursor  
instead of the hand cursor). in Safari and IE it works fine the whole  
time. I keep clicking on thumbnails, and the full images keep on  
coming up. It has to do with the effects (the appear I think),  
because when I take those out, it works fine. Any ideas?

2. When viewing the gallery “locally”, everything loads immediately  
obviously, so the fading effects look good. But when viewing the  
gallery online, the fade is fine, but the appear doesn’t work properly  
since the image isn’t even loaded. When using link\_to\_remote, you  
have the callbacks such as :complete to execute some code. Can I have  
a similar effect from a .rjs file? I don’t want to use page.delay for  
the effect since every connection will load the images at different  
speeds. If it’s not possible to do it from the .rjs file, can I  
trigger the appear from a link\_to\_remote? For some reason  
the :complete didn’t work, and I can’t seem to use call (to execute a  
javascript function) either.

Thanks in advance.
