very helpful - thank you!
now heres another question...
in jquery there is a function called slideToggle(). that will apply a
toggle but when showign the div it will slide it down, and when hiding
it it will slide it up:
http://docs.jquery.com/Effects/slideToggle
is there somethgin similar in scriptaculous that i could use to
achieve the same effect?
On Nov 27, 3:02 pm, "Nicolás Sanguinetti" <[EMAIL PROTECTED]> wrote:
> $$(".search").invoke("toggle");
>
> $ selects an element by id, $$ by CSS selector. When you have a
> collection, and want to call methods on the entire collection, invoke
> is your friend.http://prototypejs.org/api/enumerable/invoke
>
> Seehttp://thinkweb2.com/projects/prototype-checklist/for a few good
> practices that will ease hte transition from jQuery :)
>
> Best,
> -foca
>
> On Nov 27, 2007 6:00 PM, Elden <[EMAIL PROTECTED]> wrote:
>
>
>
> > and prototype gives you this behavior scriptaculus it's not necesary
>
> > On Nov 27, 2007 1:59 PM, Elden <[EMAIL PROTECTED]> wrote:
> > > the css declaration displa:none got to be inline
>
> > > <div id="capa" style="display:none"></div>
>
> > > and in your js put
>
> > > $('capa').toggle();
>
> > > this make that your div shows
>
> > > its from the example see the code
>
> > > On Nov 27, 2007 1:53 PM, bdee1 <[EMAIL PROTECTED] > wrote:
>
> > > > ok so i just found this page:
> > > >http://www.prototypejs.org/api/element/toggle
>
> > > > but i am still confused:
> > > > 1) do i need scriptaculous to get toggle functionality or do i get by
> > > > just including prototype.js?
> > > > 2) it says that it will not show divs that were hidden via css?! how
> > > > else would i hide a div? if i want the div to be hidden when the page
> > > > loads, and then toggled when a link is clicked, how woudl i do that if
> > > > i cant set the css for the div to display:none ??
>
> > > > On Nov 27, 2:46 pm, bdee1 <[EMAIL PROTECTED]> wrote:
> > > > > ok i am brand new to prototype (i am used to using jquery). i have a
> > > > > div with a class of "search" and i would like to make it so that when
> > > > > a link is clicked, the div's visibility will toggle (if its hidden it
> > > > > will be shown, if it is visible it will hide).
>
> > > > > so i was thinking that in the onClick attribute of the a tag i would
> > > > > put a simple statement like $('.search').toggle but that is the
> > > > > jquery way. looking through some tutorials for prototype it looks
> > > > > like it would have to be more like this:
>
> > > > > allNodes = document.getElementsByClassName("search");
> > > > > for(i = 0; i < allNodes.length; i++) {
> > > > > allNodes[i].toggle();
>
> > > > > }
>
> > > > > but from what i am seeing, i would also need to include scriptaculous
> > > > > to get the toggle functionality is that correct?
>
> > > > > and this seems like a lot of code (compared to jQuery) just to get a
> > > > > div to toggle. am i missing something? is there a quicker way?-
> > > > > Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---