View Full Version : hiding ALL layers in one fell swoop..how?
BrightNail
05-01-2003, 03:11 AM
is there a way to hide all layers without running thru an array...like a global layer hider or someting?
please advise?
x_goose_x
05-01-2003, 04:13 AM
Well, visibility and display are inheritted, so you can always put all the layers you want hidden in another layer, then hide the parent layer. Other than that, I don't believe it's possible.
Skyzyx
05-01-2003, 04:18 AM
It would be easier to use an array to loop through 'em all. However, on newer browsers (IE5/5.5/NS6+, etc.) you can set all the layers to the same class name, and then modify a CSS value in that class.
Something like this:
<style type="text/css">
.myClass {
display:inline;
color:#FF0000;
}
</style>
. . .
<script language="javascript" type="text/javascript">
var theClasses;
if (navigator.userAgent.indexOf('MSIE') != -1) theClasses=document.getElementsByTagName('*').getAttribute('className');
else theClasses=document.getElementsByTagName('*').getAttribute('className');
var classLen=theClasses.length;
for (x=0; x<classLen; x++)
{
theClasses[x].display=none;
}
</script>
That's more or less the idea. I hope this helps.
Graeme Hackston
05-02-2003, 12:35 AM
Here's a goofy function I use to hide the page when I don't want IE (in an hta) to scroll to images as they load.
It can be made alot smaller and should work Xmodern browser except for the scrollbar bit and currentStyle. You can plug in colour numbers in place of var Background_Colour or colour the div with css.
html:
<div id="Page-Cover"></div>
style:
#Page-Cover {
position:absolute;
top:0px;
left:0px;
display:none;
}
JS:
function Cover_Page(Toggle,Just_ScrollBar) {
var Background_Colour = document.body.currentStyle.backgroundColor
if (Toggle == 'yes') {
document.body.style.scrollbarDarkShadowColor = Background_Colour
document.body.style.scrollbarFaceColor = Background_Colour
document.body.style.scrollbarHighlightColor = Background_Colour
document.body.style.scrollbarArrowColor = Background_Colour
document.body.style.scrollbarTrackColor = Background_Colour
document.body.style.scrollbar3dLightColor = Background_Colour
document.body.style.scrollbarShadowColor = Background_Colour
if (Just_ScrollBar == null) {
var All_Selects = document.getElementsByTagName('select')
var SelectsL = All_Selects.length
for (var i=0;i<SelectsL;i++) {
All_Selects[i].style.visibility = 'hidden'
}
document.getElementById('Page-Cover').style.backgroundColor = Background_Colour
document.getElementById('Page-Cover').style.display = 'block'
document.getElementById('Page-Cover').style.zIndex = '1000'
document.getElementById('Page-Cover').style.height = document.body.scrollHeight
document.getElementById('Page-Cover').style.width = document.body.scrollWidth
}
}
if (Toggle == 'no') {
document.body.style.scrollbarDarkShadowColor = ""
document.body.style.scrollbarFaceColor = ""
document.body.style.scrollbarHighlightColor = ""
document.body.style.scrollbarArrowColor = ""
document.body.style.scrollbarTrackColor = ""
document.body.style.scrollbar3dLightColor = ""
document.body.style.scrollbarShadowColor = ""
if (Just_ScrollBar == null) {
document.getElementById('Page-Cover').style.zIndex = '0'
document.getElementById('Page-Cover').style.display = 'none'
var All_Selects = document.getElementsByTagName('select')
var SelectsL = All_Selects.length
for (var i=0;i<SelectsL;i++) {
All_Selects[i].style.visibility = 'visible'
}
}
}
}
// call
Cover_Page('yes','Just_ScrollBar')
// or
Cover_Page('no')
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.