Ruby on rails, scriptaculous (visual_effect) inside facebox not working
I use facebox to display a lightbox popup inside my RoR 2.3.9 application to display a :partial. Inside this partial, I want to toggle (or any other visual effect that would go from one div to another inside the partial) from several steps for a form_for.
When I do the following for both buttons (step 1, 2...):
<%= link_to_function "Keeps",
visual_effect(:fade, "step1", :duration => 0.2) +
visual_effect(:fade, "step2", :duration => 0.2) +
visual_effect(:grow, "step3", :duration => 0.2) %>
which show or hide the divs:
<div id="step1" class="feed_container">
content
</div>
<div id="step2" class="feed_container" style="display:none">
content
</div>
<div id="step3" class="feed_container" style="display:none">
content
</div>
It works in the "normal pages" but doesn't in the popup. If I click the go to step2 button for example, it doesn't do anything. However, i开发者_JAVA技巧f I close the popup and open it again, it'll be in step 2.
Any thoughts on how I could get this working in ruby on rails? Thanks
Prototype helpers were deprecated in Rails 3. You might be better off adopting an unobtrusive Javascript approach from now itself, since it'd be useful to pick up the know-how in the long-term.
Your browser (Firefox with the Firebug extension, or Chrome - Right click -> Inspect Element) should point out any and all errors in the generated javascript in the bottom right corner. Those errors probably hold the key to what's going wrong.
精彩评论