I do something similar to this. However, IE's support of visibility
only works for hidden and visible, not the other two, so it is
questionable depending on browser support how you would handle showv
in your example above. In general, since IE doesn't fully support
visibility I don't use the other two.

The other problem is naming these functions such that they aren't
easily confused with the display:none versions.

Here's my implementation along with some other extras:

On Aug 12, 12:12 am, PhilPantin <filip.per...@gmail.com> wrote:
> Bonjour,
> J'ai ajouté ce code à mon prototype, je pense qu'il pourrait
> être utile, mais les procédures traditionnelles (git et cie) sont un
> peu complexes pour moi. Merci si quelqu'un peut transmettre.
> Et longue vie à Prototype !
> Hi,
> I had this code to my prototype, I think it could be usefull,
> but  the way to had it in the frameword by git and co are a little
> difficult to me. Thanks if a awesome person could transmit.
> Have fun with Prototype ! (sorry for my english)
> In Element.Methods :
> (même noms que pour display, avec "v" au bout pour "visibility")
> (same names as for display, with "v" at the end, "v" for "visibility")
> [code]
>         /*--
>                 Todo:   To toggle the visibility the same way as display
>         --*/
>         togglev: function(element) {
>                 element=$(element);
>                 Element[Element.visiblev(element) ? 'hidev' : 
> 'showv'](element);
>                 return element;
>         },
>         visiblev: function(element) {
>         return $(element).style.visibility != 'hidden';
>         },
>         hidev: function(element) {
>                 element = $(element);
>                 element.style.visibility = 'hidden';
>                 return element;
>         },
>         showv: function(element) {
>                 element = $(element);
>                 element.style.visibility = 'visible';
>                 return element;
>         },
> [/code]
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to