Now Im just confuzed ... Of all the pages Ive looked at,
the only variance I made was changing the set Timeout
to a for loop.
As for the framenumbers, framelength, etc. Im just
trying to fade a couple of layers in and out and shut them
off when opacity is at 0.
It works perfectly except for the 'refresh' issue. When
I stall the script, it works... elsewise, not. I dont understand
why?
Ill show you the whole script in a minute....
get squished,
BeSquished
___________________________________________________________________________
Ive worked very hard on these scripts
Please do not rip them off--let me know of you want to use them.
This is how they work:
turn on div visibility and display, then fade in.
fade out, then turn off div visibility and display
the link in my documents calls openDiv and closeDiv
the html below is oversimplified but you get the point.
This script works Except it goes way too fast... if I
dont alert every level of fade.
Why?
--------------------------------
<head>
. . .
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide Script
function initPage() {
closeviewer();
closeDiv('frame1','career','1');
closeDiv('frame2','edutrn','1');
closeDiv('frame3','prohis','1');
closeDiv('frame4','expskl','1');
closeDiv('frame5','sample','1');
closeDiv('frame6','recomm','1');
}
function fadeFade(framec,idc,frameo,ido) {
closeDiv(framec,idc,'100');
openDiv(frameo,ido,'0');
}
// -->
</script>
<style> // base style settings
#frame1 {
visibility:hidden; display:none; position:absolute; top:0; left:0;
width:602; height:228; z-index:3;
overflow:hidden; clip:rect(0,601,229,0); border-width:3; border-style:inset;
filter:alpha(opacity=1); -moz-opacity:0.01;
layer-background-color:#336666; background-color:#336666; border-color:#333366
}
#career {
visibility:hidden; display:none; position:relative; top:0; left:0;
width:580; height:171; z-index:99;
overflow:auto; clip:rect(0,580,175,0); border-width:1; border-style:solid;
filter:alpha(opacity=1); -moz-opacity:0.01;
layer-background-color:#333366; background-color:#333366; border-color:#FFFFFF
}
. . .
</style>
<script language="Javascript" type="text/javascript">
<!-- Hide Script
function openDiv(frame,id,fad) {
showHide(frame,id) ;
fadeIn(frame,id,fad) ;
}
function closeDiv(frame,id,fad) {
fadeOut(frame,id,fad) ;
showHide(frame,id) ;
}
function fadeIn(frame,id,fad) {
if (document.all) {
if (fad != 100) {
fadnew = ++fad;
document.getElementById(frame).filters.alpha.opacity = fadnew ;
document.all(id).filters.alpha.opacity = fadnew ;
}
else {
document.getElementById(frame).filters.alpha.opacity = fad ;
document.all(id).filters.alpha.opacity = fad ;
return ;
}
}
else if (document.getElementById) {
if (fad != 100) {
fadnew = ++fad;
document.getElementById(frame).style.MozOpacity = (fadnew / 100) ;
document.getElementById(id).style.MozOpacity = (fadnew / 100) ;
}
else {
document.getElementById(frame).style.MozOpacity = (fad / 100) ;
document.getElementById(id).style.MozOpacity = (fad / 100) ;
return ;
}
}
fad = null;
fad = fadnew;
setTimeout('fadeIn(frame,id,fad)',500) ;
}
function fadeOut(frame,id,fad) {
if (document.all) {
if (fad != 0) {
fadnew = --fad;
document.all[frame].filters.alpha.opacity = fadnew ;
document.all[id].filters.alpha.opacity = fadnew ;
}
else {
document.all[frame].filters.alpha.opacity = fad ;
document.all[id].filters.alpha.opacity = fad ;
return;
}
}
else if (document.getElementById) {
if (fad != 0) {
fadnew = --fad;
document.getElementById(frame).style.MozOpacity = (fadnew / 100) ;
document.getElementById(id).style.MozOpacity = (fadnew / 100) ;
}
else {
document.getElementById(frame).style.MozOpacity = (fad / 100) ;
document.getElementById(id).style.MozOpacity = (fad / 100) ;
return;
}
}
fad = null;
fad = fadnew;
setTimeout('fadeOut(frame,id,fad)',500) ;
}
function showHide(frame,id) {
if (document.all) {
var vis = (document.all[id].style.visibility ) ;
var vis = (document.all[id].style.visibility == 'hidden') ? 'visible' : 'hidden';
document.all[frame].style.visibility = vis ;
document.all[id].style.visibility = vis;
var dis = (document.all[id].style.display) ;
var dis = (document.all[id].style.display == 'none') ? 'block' : 'none' ;
document.all[frame].style.display = dis;
document.all[id].style.display = dis;
var tops = ((document.body.clientHeight / 2) - 69) ;
document.all[frame].style.top = tops;
var lefty = ((document.body.clientWidth / 2) - 325) ;
document.all[frame].style.left = lefty;
}
else if (document.getElementById) {
var vis = (document.getElementById(id).style.visibility) ;
var vis = (document.getElementById(id).style.visibility == 'hidden') ? 'visible' : 'hidden';
document.getElementById(frame).style.visibility = vis;
document.getElementById(id).style.visibility = vis;
var dis = (document.getElementById(id).style.display) ;
var dis = (document.getElementById(id).style.display == 'none') ? 'block' : 'none';
document.getElementById(frame).style.display = dis;
document.getElementById(id).style.display = dis;
var tops = ((document.body.clientHeight / 2) - 83) ;
document.getElementById(frame).style.top = tops;
var lefty = ((document.body.clientWidth / 2) - 336) ;
document.getElementById(frame).style.left = lefty;
}
}
// -->
</script>
</head>
<body>
<a href=javascript penDiv(frame1,career,0)>Career Highlights</a>
<div id:Frame1>
Career Highlights
<a href =javascript:fadeFade(frame1,career,frame2,references)>Next:Refs</a>
<div id:career>
. . .
</div>
<a href=js:closeDiv(frame1,career,100)>Close</a>
</div>
blah blah
</body>
</html>
[This message has been edited by BeSquished (edited 09-28-2003).]
[This message has been edited by BeSquished (edited 09-28-2003).]