Hola Gente, necesito una ayuda con el siguiente codigo.
Quiero que la capa es esta oculta por el efecto clip, se mueva en forma vertical en la pagina cuando hago un scroll para que me quede siempre en el mismo lugar, como si estuviera fija.
Como lo logro esto?
<HTML>
<HEAD>
<SCRIPT>
<!--
n = (document.layers) ? 1:0
ie = (document.all) ? 1:0
function init() {
if (n) block = document.blockDiv
if (ie) block = blockDiv.style
if (n) block2 = document.blockDiv2
if (ie) block2 = blockDiv2.style
}
function clipValues(obj,which) {
if (n) {
if (which=="t") return obj.clip.top
if (which=="r") return obj.clip.right
if (which=="b") return obj.clip.bottom
if (which=="l") return obj.clip.left
}
else if (ie) {
var clipv = obj.clip.split("rect(")[1].split(")")[0].split("px")
if (which=="t") return Number(clipv[0])
if (which=="r") return Number(clipv[1])
if (which=="b") return Number(clipv[2])
if (which=="l") return Number(clipv[3])
}
}
function clipTo(obj,t,r,b,l) {
if (n) {
obj.clip.top = t
obj.clip.right = r
obj.clip.bottom = b
obj.clip.left = l
}
else if (ie) obj.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)"
}
function clipBy(obj,t,r,b,l) {
if (n) {
obj.clip.top = clipValues(obj,'t') + t
obj.clip.right = clipValues(obj,'r') + r
obj.clip.bottom = clipValues(obj,'b') + b
obj.clip.left = clipValues(obj,'l') + l
}
else if (ie) obj.clip = "rect("+(this.clipValues(obj,'t')+t)+"px "+(this.clipValues(obj,'r')+r)+"px "+Number(this.clipValues(obj,'b')+b)+"px "+Number(this.clipValues(obj,'l')+l)+"px)"
}
function wipe1() {
if (clipValues(block,'r')<350) {
clipBy(block,0,5,0,0)
setTimeout("wipe1()",13)
}
}
function wipe2() {
if (clipValues(block,'r')>0) {
clipBy(block,0,-5,0,0)
setTimeout("wipe2()",13)
}
}
function wipe3() {
if (clipValues(block2,'r')<350) {
clipBy(block2,0,5,0,0)
setTimeout("wipe3()",13)
}
}
function wipe4() {
if (clipValues(block2,'r')>0) {
clipBy(block2,0,-5,0,0)
setTimeout("wipe4()",13)
}
}
//-->
</SCRIPT>
<style type="text/css">
<!--
body {overflow:auto
}
#blockDiv { position:absolute; top:40; left:100;
}
-->
</style>
<TITLE>Dynamic HTML - demostración práctica </TITLE>
</HEAD>
<BODY onLoad="init()">
<div style="position:absolute; top:100px; left:70px; font-size:30px; font-family:ARIAL; width:350px; heigth:200px;">
LAYER A<BR><BR>
<CENTER><A HREF="javascript:wipe1(),wipe4()">Nuevo layer</A></CENTER>
</div>
<DIV ID="blockDiv" STYLE="font-size:30px; font-family:ARIAL; clip:rect(0,0,400,0); width:350px; height:300px; background-color:#0080FF; layer-background-color:#0080FF; color:#FFFFFF;">
LAYER B<BR><BR>
<A HREF="javascript:wipe2()">Vuelve atrás</A>
</div>
<div style="position:absolute; top:500px; left:70px; font-size:30px; font-family:ARIAL; width:350px; heigth:200px;">
LAYER C<BR><BR>
<CENTER><A HREF="javascript:wipe3(),wipe2()">Nuevo layer</A></CENTER>
</div>
<DIV ID="blockDiv2" STYLE="position:absolute; top:397px; left:70px; font-size:30px; font-family:ARIAL; clip:rect(0,0,400,0); width:350px; height:300px; background-color:#0080FF; layer-background-color:#0080FF; color:#FFFFFF;">
LAYER D<BR>
<BR>
<A HREF="javascript:wipe4()">Vuelve atrás</A>
</div>
</BODY>
</HTML>
Quiero que la capa es esta oculta por el efecto clip, se mueva en forma vertical en la pagina cuando hago un scroll para que me quede siempre en el mismo lugar, como si estuviera fija.
Como lo logro esto?
<HTML>
<HEAD>
<SCRIPT>
<!--
n = (document.layers) ? 1:0
ie = (document.all) ? 1:0
function init() {
if (n) block = document.blockDiv
if (ie) block = blockDiv.style
if (n) block2 = document.blockDiv2
if (ie) block2 = blockDiv2.style
}
function clipValues(obj,which) {
if (n) {
if (which=="t") return obj.clip.top
if (which=="r") return obj.clip.right
if (which=="b") return obj.clip.bottom
if (which=="l") return obj.clip.left
}
else if (ie) {
var clipv = obj.clip.split("rect(")[1].split(")")[0].split("px")
if (which=="t") return Number(clipv[0])
if (which=="r") return Number(clipv[1])
if (which=="b") return Number(clipv[2])
if (which=="l") return Number(clipv[3])
}
}
function clipTo(obj,t,r,b,l) {
if (n) {
obj.clip.top = t
obj.clip.right = r
obj.clip.bottom = b
obj.clip.left = l
}
else if (ie) obj.clip = "rect("+t+"px "+r+"px "+b+"px "+l+"px)"
}
function clipBy(obj,t,r,b,l) {
if (n) {
obj.clip.top = clipValues(obj,'t') + t
obj.clip.right = clipValues(obj,'r') + r
obj.clip.bottom = clipValues(obj,'b') + b
obj.clip.left = clipValues(obj,'l') + l
}
else if (ie) obj.clip = "rect("+(this.clipValues(obj,'t')+t)+"px "+(this.clipValues(obj,'r')+r)+"px "+Number(this.clipValues(obj,'b')+b)+"px "+Number(this.clipValues(obj,'l')+l)+"px)"
}
function wipe1() {
if (clipValues(block,'r')<350) {
clipBy(block,0,5,0,0)
setTimeout("wipe1()",13)
}
}
function wipe2() {
if (clipValues(block,'r')>0) {
clipBy(block,0,-5,0,0)
setTimeout("wipe2()",13)
}
}
function wipe3() {
if (clipValues(block2,'r')<350) {
clipBy(block2,0,5,0,0)
setTimeout("wipe3()",13)
}
}
function wipe4() {
if (clipValues(block2,'r')>0) {
clipBy(block2,0,-5,0,0)
setTimeout("wipe4()",13)
}
}
//-->
</SCRIPT>
<style type="text/css">
<!--
body {overflow:auto
}
#blockDiv { position:absolute; top:40; left:100;
}
-->
</style>
<TITLE>Dynamic HTML - demostración práctica </TITLE>
</HEAD>
<BODY onLoad="init()">
<div style="position:absolute; top:100px; left:70px; font-size:30px; font-family:ARIAL; width:350px; heigth:200px;">
LAYER A<BR><BR>
<CENTER><A HREF="javascript:wipe1(),wipe4()">Nuevo layer</A></CENTER>
</div>
<DIV ID="blockDiv" STYLE="font-size:30px; font-family:ARIAL; clip:rect(0,0,400,0); width:350px; height:300px; background-color:#0080FF; layer-background-color:#0080FF; color:#FFFFFF;">
LAYER B<BR><BR>
<A HREF="javascript:wipe2()">Vuelve atrás</A>
</div>
<div style="position:absolute; top:500px; left:70px; font-size:30px; font-family:ARIAL; width:350px; heigth:200px;">
LAYER C<BR><BR>
<CENTER><A HREF="javascript:wipe3(),wipe2()">Nuevo layer</A></CENTER>
</div>
<DIV ID="blockDiv2" STYLE="position:absolute; top:397px; left:70px; font-size:30px; font-family:ARIAL; clip:rect(0,0,400,0); width:350px; height:300px; background-color:#0080FF; layer-background-color:#0080FF; color:#FFFFFF;">
LAYER D<BR>
<BR>
<A HREF="javascript:wipe4()">Vuelve atrás</A>
</div>
</BODY>
</HTML>