spacer
Yehuda Shiran September 3, 2000
Removing Object without Reflowing
Tips: September 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management
While setting the display property to none removes the paragraph and reclaims the empty space, turning the visibility property on and off just makes the paragraph transparent, without reflowing the page. Clicking the following link will turn off and on the visibility of the first paragraph:

Click here to remove or bring back the first paragraph below:

Mouse over this paragraph and see how the font size changes to size 30. Mouse out and see it go down to 8. This is a good way to pack more text on a window-size page and let the user magnify the paragraph currently being read. See how the browser reflows the page as if this paragraph was originally written with the current font size.

Mouse over this paragraph and see how the font family changes to size Courier. Mouse out and see it changing to Arial. This is a good way to emphasize the paragraph currently being read. See how the browser reflows the page as if this paragraph was originally written with the current font family.

We defined the link above as follows:

<SPAN STYLE="cursor: hand; color: tan" onClick="disappear(fontPar)">Click here to remove or 
  bring back the first paragraph below:</SPAN>

where the function disappear() is defined as:

function disappear(obj) {
  if (obj.style.visibility == "hidden") {
    obj.style.visibility = "visible";
  }
  else {
    obj.style.visibility = "hidden";
  }
}


People who read this tip also read these tips:

Look for similar tips by subject:

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags