jQuery.fn.toggleVis = function() {
   // Here, "this" is the jQuery object
   // This return statement is used for two reasons
   //   1. To make sure we hit every HTML element in the jQuery object
   //   2. To make sure that this method doesn't "break the chain"
   return this.each(function() {
       // Iterate over all selected HTML elements and toggle their
"visibility" CSS property
       // Here, "this" a HTML element
       if(this.style.visibility == 'hidden') {
           this.style.visibility = 'visible';
       } else {
           this.style.visibility = 'hidden';
       }
   });
};

Usage: $('mySelector').toggleVis();

On 7/23/07, Mitchell Waite <[EMAIL PROTECTED]> wrote:


I like jQuery effects show and hide but they actually remove the object
from the screen. So an <H1> under an image will move up.

Can someone show me the best way to change (toggle) an objects
"visibility" property between "hidden" and "visible" so any HTML under it
will not move.

Mitch





--
Aaron Heimlich
Web Developer
[EMAIL PROTECTED]
http://aheimlich.freepgs.com

Reply via email to