canadianjameson
01-21-2006, 09:47 PM
Hey.
I found a seemingly cross-browser page transition script and I was wondering if anyone knew how to modify it as follows: currently it boxes-in, I would like it to circle-out. Can it be done... *cue cheezy lighting strike in background*
I found it here:
http://www.siteexperts.com/tips/styles/ts30/page2.asp
and here's the code and info from the page:
<STYLE>
<!--
#box {position: absolute; top:0; left: 0;z-index: 100; background: Navy;
layer-background-color:Navy; border: .1px solid navy; clip: rect(0 100% 100% 0)}
-->
</STYLE>
Next, you need to define a DIV that represents the transition effect. This DIV is displayed the full width and height of your screen (initialized by code in next step), and then is resized smaller and smaller. This creates the illusion of a box transition effect.
You should include this DIV immediately following the <BODY> tag on your page.
<DIV ID=box></DIV>
Last, you need to include the following script on your page. The script resized the box by adjusting the clipping rectangle. To resolve the object model differences, the script needs to detect and run slightly different scripts to adjust the sizes:
This script should be included immediately following the above DIV. By placing this script following the DIV, but before your pages content, you cause the transition to start as soon as possible.
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
// Box Transition Effect
// Copyright 1998, InsideDHTML.com, LLC. All rights reserved
// See http://www.insideDHTML.com for more information
// This code can be reused as long as the above notice is retained.
// Determine Version
var NS =navigator.appName == "Netscape"
var MS = navigator.appName == "Microsoft Internet Explorer"
var ver = parseInt(navigator.appVersion)
var NS4 = NS && ver>=4
var IE4 = MS && ver>=4
// This determines how fast of a transition
var steps = 50
var box = null
function startup() {
if (NS4 || IE4) {
if (IE4) {
box = document.all.box
var nWidth = box.style.pixelWidth = document.body.clientWidth
var nHeight = box.style.pixelHeight = document.body.clientHeight
} else {
box = document.layers.box
var nWidth = box.clip.width = window.innerWidth
var nHeight = box.clip.height = window.innerHeight
}
var nTop = nLeft = 0
destWidth = nWidth/2
destHeight = nHeight/2
var stepWidth = destWidth/steps
var stepHeight = destHeight/steps
boxIn(nTop, nLeft, nWidth, nHeight, stepWidth,stepHeight)
}
}
// Small timeout allows IE5 to recalc document.
setTimeout("startup()",0)
function boxIn(nTop, nLeft, nWidth, nHeight, stepWidth,stepHeight) {
nWidth -= stepWidth*2
nHeight -= stepHeight*2
nLeft += stepWidth
nTop += stepHeight
if (IE4) {
nLeft += stepWidth
nTop += stepHeight
box.style.pixelTop = document.body.scrollTop
box.style.pixelLeft = document.body.scrollLeft
box.style.clip = "rect(" + nTop + " " + nWidth + " " + nHeight + " " + nLeft + ")"
}
else
{
box.top = window.pageYOffset
box.left = window.pageXOffset
box.clip.left = nLeft
box.clip.width = nWidth
box.clip.top = nTop
box.clip.height = nHeight
}
steps--
if (steps>0)
setTimeout("boxIn(" + nTop + "," + nLeft + "," + nWidth + "," + nHeight + "," + stepWidth + "," + stepHeight + ")",10)
}
// -->
</SCRIPT>
I found a seemingly cross-browser page transition script and I was wondering if anyone knew how to modify it as follows: currently it boxes-in, I would like it to circle-out. Can it be done... *cue cheezy lighting strike in background*
I found it here:
http://www.siteexperts.com/tips/styles/ts30/page2.asp
and here's the code and info from the page:
<STYLE>
<!--
#box {position: absolute; top:0; left: 0;z-index: 100; background: Navy;
layer-background-color:Navy; border: .1px solid navy; clip: rect(0 100% 100% 0)}
-->
</STYLE>
Next, you need to define a DIV that represents the transition effect. This DIV is displayed the full width and height of your screen (initialized by code in next step), and then is resized smaller and smaller. This creates the illusion of a box transition effect.
You should include this DIV immediately following the <BODY> tag on your page.
<DIV ID=box></DIV>
Last, you need to include the following script on your page. The script resized the box by adjusting the clipping rectangle. To resolve the object model differences, the script needs to detect and run slightly different scripts to adjust the sizes:
This script should be included immediately following the above DIV. By placing this script following the DIV, but before your pages content, you cause the transition to start as soon as possible.
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
// Box Transition Effect
// Copyright 1998, InsideDHTML.com, LLC. All rights reserved
// See http://www.insideDHTML.com for more information
// This code can be reused as long as the above notice is retained.
// Determine Version
var NS =navigator.appName == "Netscape"
var MS = navigator.appName == "Microsoft Internet Explorer"
var ver = parseInt(navigator.appVersion)
var NS4 = NS && ver>=4
var IE4 = MS && ver>=4
// This determines how fast of a transition
var steps = 50
var box = null
function startup() {
if (NS4 || IE4) {
if (IE4) {
box = document.all.box
var nWidth = box.style.pixelWidth = document.body.clientWidth
var nHeight = box.style.pixelHeight = document.body.clientHeight
} else {
box = document.layers.box
var nWidth = box.clip.width = window.innerWidth
var nHeight = box.clip.height = window.innerHeight
}
var nTop = nLeft = 0
destWidth = nWidth/2
destHeight = nHeight/2
var stepWidth = destWidth/steps
var stepHeight = destHeight/steps
boxIn(nTop, nLeft, nWidth, nHeight, stepWidth,stepHeight)
}
}
// Small timeout allows IE5 to recalc document.
setTimeout("startup()",0)
function boxIn(nTop, nLeft, nWidth, nHeight, stepWidth,stepHeight) {
nWidth -= stepWidth*2
nHeight -= stepHeight*2
nLeft += stepWidth
nTop += stepHeight
if (IE4) {
nLeft += stepWidth
nTop += stepHeight
box.style.pixelTop = document.body.scrollTop
box.style.pixelLeft = document.body.scrollLeft
box.style.clip = "rect(" + nTop + " " + nWidth + " " + nHeight + " " + nLeft + ")"
}
else
{
box.top = window.pageYOffset
box.left = window.pageXOffset
box.clip.left = nLeft
box.clip.width = nWidth
box.clip.top = nTop
box.clip.height = nHeight
}
steps--
if (steps>0)
setTimeout("boxIn(" + nTop + "," + nLeft + "," + nWidth + "," + nHeight + "," + stepWidth + "," + stepHeight + ")",10)
}
// -->
</SCRIPT>