/    Sign up×
Community /Pin to ProfileBookmark

cursortrail, problem while scrolling, please help!!

Hi there!,

First i want to say that i am dutch, so my english will not be perfect

I have made an webpage with 3 frames,
with a cursor that is followed by a string.

Now the following error encouterd:

When i scroll in the mainframe, it doesn’t work properly anymore.

At first you can see a sample where i am at the moment:

[url]http://intranet.dhn.nl/nick/testopdracht/[/url]

As you can see, when there is no scrollbar in the mainframe everything works perfect. but when you scroll down, it doesn’t anymore.

This is my code:

[CODE]
//aanmaken availframes array
availFrames = new Array ();
availFrames[0] = Array (“topframe”, 0, 0, 0, 0); //naam,breedte,hoogte,correctie X,correctie Y
availFrames[1] = Array (“leftframe”, 0, 0, 0, 0);
availFrames[2] = Array (“mainframe”, 0, 0, 0, 0);

//variable waarin de naam word vastgelegd van de frame waar nu in gewerkt wordt
var currentFrame = this.name;
var activeFrame = this.name;

function windowResize () {
for (h=0; h<availFrames.length; h++) {
availFrames[h][1] = parent.document.all(availFrames[h][0]).Width;
availFrames[h][2] = parent.document.all(availFrames[h][0]).Height;
}

switch (currentFrame) {
case availFrames[0][0]: //wanneer we in frame topframe zitten
availFrames[1][4] = -availFrames[0][2]; //leftframe correctie Y = leftframe hoogte – topframe hoogte
availFrames[2][3] = -availFrames[1][1]; //mainframe correctie X = mainframe breedte – leftframe breedte
availFrames[2][4] = -availFrames[0][2]; //mainframe correctie Y = mainframe hoogte – topframe hoogte
break;
case availFrames[1][0]: //wanneer we in frame leftframe zitten
availFrames[0][4] = availFrames[0][2]; //topframe correctie Y = topframe hoogte
availFrames[2][3] = -availFrames[1][1]; //mainframe correctie X = mainframe brredte – leftframe breedte
break;
case availFrames[2][0]: //wanneer we in frame mainframe zitten
availFrames[0][3] = availFrames[1][1]; //topframe correctie X = leftframe breedte
availFrames[0][4] = availFrames[0][2]; //topframe correctie Y = topframe hoogte
availFrames[1][3] = availFrames[1][1]; //leftframe correctie X = leftframe breedte
break;
}
}

//—————————————— Frames hierboven ————————————————–
//—————————————— Nu volgt Balls ————————————————–

//——— Aanmaken van ballen ———–

images=new Array (“ball.bmp”,30,30,”ball.bmp”,30,30,”ball.bmp”,30,30,”ball.bmp”,30,30,”ball.bmp”,30,30,”ball.bmp”,30,30,”ball.bmp”,30,30,”ball.bmp”,30,30,”ball.bmp”,30,30,”ball.bmp”,30,30);
nob=parseInt (images.length/3); // number of balls

for (h=0; h < nob; h++){
// Naam ster, begin positie X, begin positie Y, breedte, hoogte, definitie image HTML code
createBall (“ball”+h, -200, -200, images[(h*3+1)], images[(h*3+2)], “<img src='”+images[h*3]+”‘ width=”+images[(h*3+1)]+” height=”+images[(h*3+2)]+” border=0>”);
}

function createBall (N, Xp, Yp, W, H, Img){ //div id, xpos, ypos, width, height, img
with (document){
write(“<div id='”+N+”‘”+” style=’position:absolute;left:”+Xp+”; top:”+Yp+”; width:”+W+”; height:”+H+”;’>”);
write(Img); // afbeelding ster wordt neergezet
write(“</div>”); // einde layer/div
}
}

//———- einde aanmaken ballen ———–

B = document.all;

// alle ballen op de plaats van de volgende bal
function cycle () {

correctTop = parent.frames(availFrames[2][0]).document.body.scrollTop;
for (i=0;i<(nob-1);i++){

xposi = parseInt(document.all[“ball”+(i+1)].style.left);
yposi = parseInt(document.all[“ball”+(i+1)].style.top);

parent.frames(availFrames[2][0]).B[“ball” + i].style.left = xposi + availFrames[2][3];
parent.frames(availFrames[2][0]).B[“ball” + i].style.top = yposi + availFrames[2][4] + correctTop;
parent.frames(availFrames[1][0]).B[“ball” + i].style.left = xposi + availFrames[1][3];
parent.frames(availFrames[1][0]).B[“ball” + i].style.top = yposi + availFrames[1][4];
parent.frames(availFrames[0][0]).B[“ball” + i].style.left = xposi + availFrames[0][3];
parent.frames(availFrames[0][0]).B[“ball” + i].style.top = yposi + availFrames[0][4];

}
}

function followmouse(){

correctTop = parent.frames(availFrames[2][0]).document.body.scrollTop;
xpos = event.clientX;
ypos = event.clientY;

parent.frames(availFrames[2][0]).B[“ball” + (nob-1)].style.left = xpos + availFrames[2][3];
parent.frames(availFrames[2][0]).B[“ball” + (nob-1)].style.top = ypos + availFrames[2][4] + correctTop;
parent.frames(availFrames[1][0]).B[“ball” + (nob-1)].style.left = xpos + availFrames[1][3];
parent.frames(availFrames[1][0]).B[“ball” + (nob-1)].style.top = ypos + availFrames[1][4];
parent.frames(availFrames[0][0]).B[“ball” + (nob-1)].style.left = xpos + availFrames[0][3];
parent.frames(availFrames[0][0]).B[“ball” + (nob-1)].style.top = ypos + availFrames[0][4];

}
setTimeout (‘setInterval (“cycle ()”, 50)’, 500);
setTimeout (‘document.onmousemove = followmouse ‘, 500);[/CODE]

I hope somebody can help me.

friendly greets,

Nick

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@nikoklikoauthorOct 30.2006 — Anybody? please?
×

Success!

Help @nikokliko spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...