meganclash
07-09-2005, 03:47 AM
hi everyone
i wanted to make a simple splashpage with a rather wide image (its just one big image slapped together from smaller ones. i am lazy!) scrolling from right to left and taking up the entire width of the browser.
here is what i have so far that works in IE but i dont really understand how to have it function in firefox as well??
http://iblastoff.net/scroll
in firefox, the image shows up but does not scroll. if you look at it in IE you'll see what i mean and want. i have to admit this script was a sample from the net a few YEARS ago so i guess it might be outdated. i've looked for other seemingly simple scripts but none of them seem to allow me to scroll the whole width of the screen? (they all ask me to input an actual width in pixels and that just messes it up for everyone not running the same resolution as i am) and i also want the image to ALREADY be on the screen and moving, whereas a lot of other scripts seem to make it slowly appear.
i know im not supposed to post the entire script but i really dont know where to start looking? i just want some of my photo work to be online and don't have the time to learn a whole language. i am completely fine with some basic and intermediate html but javascript is beyond my skills at the moment. anyways thanks for looking!
ps if you look at my page, there are actually three frames there. i dont think anyone uses frames anymore. but its what i know and if it works then meh!
-meg
script below
-----
<html>
<head>
<title>Megan Hostel</title>
<script language="JavaScript">
<!--
window.onerror=null
var TimerID = null;
var timer = 0;
var z = 2;
var v = 3;
var ver = 3
bVer = parseInt(navigator.appVersion);
if(bVer >= 4) ver = 4
var ns = navigator.appName == "Netscape";
var ie = navigator.appName == "MSIE";
var pix = 4; // number of pixels to move per frame
var rate = 30; // fps
var ImgWidth = 1528; // width of whatever
var time = 1528/rate;
var again = - ImgWidth
function tick() {
if (ver ==3) return
if (ns){
document.Layer1.offset(-pix,0);
document.Layer2.offset(-pix,0);
if (document.Layer1.left <= again) document.Layer1.left = ImgWidth;
if (document.Layer2.left <= again) document.Layer2.left = ImgWidth;
}
else {
newpix = document.all["Layer1"].style.pixelLeft - pix;
newpix2 = document.all["Layer2"].style.pixelLeft - pix;
document.all["Layer1"].style.pixelLeft = newpix;
document.all["Layer2"].style.pixelLeft = newpix2;
if (document.all["Layer1"].style.pixelLeft <= again) document.all["Layer1"].style.pixelLeft = ImgWidth;
if (document.all["Layer2"].style.pixelLeft <= again) document.all["Layer2"].style.pixelLeft = ImgWidth;
}
setTimeout('tick()', time);
}
//-->
</script>
</head>
<body background="" bgcolor="#FFFFFF" marginheight="0" marginwidth="0" marginright="0"
marginleft="0" topmargin="0" bottommargin="0" onLoad="tick()">
<div align="left">
<table border="0" cellpadding="0" cellspacing="0" columns="0">
<tr>
<td>
<span id="Layer1" style="position:absolute; width:1528; height:125; z-index:2; left: 0px; top: 0px">
<img src="splash2.gif" width="1528" height="125" border="0">
</span>
<span id="Layer2" style="position:absolute; width:1528; height:125; z-index:1; left: 1528; top: 0px">
<img src="splash2.gif" width="1528" height="125" border="0">
</span>
</td>
</tr>
</table>
</div>
</body>
</html>
i wanted to make a simple splashpage with a rather wide image (its just one big image slapped together from smaller ones. i am lazy!) scrolling from right to left and taking up the entire width of the browser.
here is what i have so far that works in IE but i dont really understand how to have it function in firefox as well??
http://iblastoff.net/scroll
in firefox, the image shows up but does not scroll. if you look at it in IE you'll see what i mean and want. i have to admit this script was a sample from the net a few YEARS ago so i guess it might be outdated. i've looked for other seemingly simple scripts but none of them seem to allow me to scroll the whole width of the screen? (they all ask me to input an actual width in pixels and that just messes it up for everyone not running the same resolution as i am) and i also want the image to ALREADY be on the screen and moving, whereas a lot of other scripts seem to make it slowly appear.
i know im not supposed to post the entire script but i really dont know where to start looking? i just want some of my photo work to be online and don't have the time to learn a whole language. i am completely fine with some basic and intermediate html but javascript is beyond my skills at the moment. anyways thanks for looking!
ps if you look at my page, there are actually three frames there. i dont think anyone uses frames anymore. but its what i know and if it works then meh!
-meg
script below
-----
<html>
<head>
<title>Megan Hostel</title>
<script language="JavaScript">
<!--
window.onerror=null
var TimerID = null;
var timer = 0;
var z = 2;
var v = 3;
var ver = 3
bVer = parseInt(navigator.appVersion);
if(bVer >= 4) ver = 4
var ns = navigator.appName == "Netscape";
var ie = navigator.appName == "MSIE";
var pix = 4; // number of pixels to move per frame
var rate = 30; // fps
var ImgWidth = 1528; // width of whatever
var time = 1528/rate;
var again = - ImgWidth
function tick() {
if (ver ==3) return
if (ns){
document.Layer1.offset(-pix,0);
document.Layer2.offset(-pix,0);
if (document.Layer1.left <= again) document.Layer1.left = ImgWidth;
if (document.Layer2.left <= again) document.Layer2.left = ImgWidth;
}
else {
newpix = document.all["Layer1"].style.pixelLeft - pix;
newpix2 = document.all["Layer2"].style.pixelLeft - pix;
document.all["Layer1"].style.pixelLeft = newpix;
document.all["Layer2"].style.pixelLeft = newpix2;
if (document.all["Layer1"].style.pixelLeft <= again) document.all["Layer1"].style.pixelLeft = ImgWidth;
if (document.all["Layer2"].style.pixelLeft <= again) document.all["Layer2"].style.pixelLeft = ImgWidth;
}
setTimeout('tick()', time);
}
//-->
</script>
</head>
<body background="" bgcolor="#FFFFFF" marginheight="0" marginwidth="0" marginright="0"
marginleft="0" topmargin="0" bottommargin="0" onLoad="tick()">
<div align="left">
<table border="0" cellpadding="0" cellspacing="0" columns="0">
<tr>
<td>
<span id="Layer1" style="position:absolute; width:1528; height:125; z-index:2; left: 0px; top: 0px">
<img src="splash2.gif" width="1528" height="125" border="0">
</span>
<span id="Layer2" style="position:absolute; width:1528; height:125; z-index:1; left: 1528; top: 0px">
<img src="splash2.gif" width="1528" height="125" border="0">
</span>
</td>
</tr>
</table>
</div>
</body>
</html>