This definitely works: <%= button_to_remote "Test", :complete => visual_effect( :toggle_appear, "toggle_appear" ) %> <div id="toggle_appear"> yada yada yada </div> To toggle content off -> content on, etc. But is there any way to have the initial content hidden? Many TIA, Craig -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
try <div id="toggle_appear" style="display:none;"> yada yada yada </div> On Mon, Mar 29, 2010 at 2:05 PM, Dudebot <craignied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> This definitely works: > > <%= button_to_remote "Test", :complete => > visual_effect( :toggle_appear, "toggle_appear" ) %> > <div id="toggle_appear"> yada yada yada </div> > > To toggle content off -> content on, etc. > > But is there any way to have the initial content hidden? > > Many TIA, > Craig > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 28, 11:10 pm, Yong Gu <zerogy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> try <div id="toggle_appear" style="display:none;"> yada yada yada </div>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 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 Mon, Mar 29, 2010 at 2:15 PM, Dudebot
<craignied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Mar 28, 11:10 pm, Yong Gu
<zerogy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > try <div id="toggle_appear"
style="display:none;"> yada yada yada </div>
>
> 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
>
> --
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 28, 11:24 pm, Yong Gu <zerogy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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.
On Mon, Mar 29, 2010 at 2:40 PM, Dudebot
<craignied-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> On Mar 28, 11:24 pm, Yong Gu
<zerogy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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
>
> --
> 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> To unsubscribe from this group, send email to
>
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
> .
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
--
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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mar 28, 11:49 pm, Yong Gu <zerogy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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! -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.