spacer

Webref WebRef   Sitemap · Experts · Tools · Services · Newsletters · About i.com

home / experts / javascript / column66


Dynamic Styles

Developer News
Mandrake Linux Founder Back, Virtually
Amazon: We're a Technology Company
Sun Expands MySQL With Closed Source

Hiding Elements without Reflowing

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. Here is the former example, only this time clicking the 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.

Notice how the emptied space is not reclaimed back by the browser. Comparing this page with Page 5, the only difference is the definition of the disappear() function. For visibility changes it is:

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

How to change styles using classes

http://www.internet.com

Produced by Yehuda Shiran and Tomer Shiran

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 >
Administering RBAC in PHP 5 CMS Framework · xref: Automatic Cross Referencing Script · Book Review: Content Rich
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


Created: August 14, 2000
Revised: August 20, 2000

URL: http://www.webreference.com/js/column66/***PASTE FILENAME HERE***