Dynamic Styles: Hiding Elements without Reflowing
Dynamic Styles
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:
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
Produced by Yehuda Shiran and Tomer Shiran
Created: August 14, 2000
Revised: August 20, 2000
URL: http://www.webreference.com/js/column66/***PASTE FILENAME HERE***

Find a programming school near you