This definitely works:
<%= button_to_remote “Test”, :complete =>
visual_effect( :toggle_appear, “toggle_appear” ) %>
To toggle content off -> content on, etc.
But is there any way to have the initial content hidden?
Many TIA,
Craig
This definitely works:
<%= button_to_remote “Test”, :complete =>
visual_effect( :toggle_appear, “toggle_appear” ) %>
To toggle content off -> content on, etc.
But is there any way to have the initial content hidden?
Many TIA,
Craig
try
i never tried that, but i think you could iterate the elements with the
class name like:
$$(’.clazz’).each(function(e) {
e.toggle();
})
or else, you could write your own function, for example:
function toggle_all() {
toggle1();
toggle2();
…
}
function toggle1() {
…
}
function toggle2() {
…
}
On Mar 28, 11:10 pm, Yong Gu [email protected] wrote:
try
yada yada yada
Thanks, Yong!
One other question: is it possible to have multiple divs toggling on/
off at the same time? I tried changing “id” to “class”, and then it
simply wouldn’t toggle.
Many TIA again,
Craig
On Mar 28, 11:24 pm, Yong Gu [email protected] wrote:
i never tried that, but i think you could iterate the elements with the
class name like:
…
Thanks–I was hoping that I could chain the events within/around the
visual_effect method–any idea if that’s possible in this framework?
Many TIA again,
Craig
On Mar 28, 11:49 pm, Yong Gu [email protected] wrote:
try <%= button_to_remote “Test”, :complete => “toggle_all();” %>
…
Thanks! I discovered this morning that + is defined for complete, so
that
<%= button_to_remote “Test”, :complete =>
visual_effect( :toggle_appear, “toggle_appear” ) +
visual_effect( :toggle_appear, “toggle_appear2” ) %>
works, which is pretty cool. It’s arguably less elegant than your
solution, but it keeps it purely railsy
Again, many thanks!
yes, of course
try <%= button_to_remote “Test”, :complete => “toggle_all();” %>
which toggle_all is your own defined javascript funciton or use
$(’.clazz’).each(function(e) { e.toggle()} ) directly instead of
toggle_all()
in fact, the value of parameter :complete is a javascript function , and
visual_effect generate a function by using prototype.js. So you could
use any javascript function as you wish.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs