Closed Thread Icon

Preserved Topic: Can anyone tell me why my sliding script is so damn slow! (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=18539" title="Pages that link to Preserved Topic: Can anyone tell me why my sliding script is so damn slow! (Page 1 of 1)" rel="nofollow" >Preserved Topic: Can anyone tell me why my sliding script is so damn slow! <span class="small">(Page 1 of 1)</span>\

 
bussman
Obsessive-Compulsive (I) Inmate

From: the land of oz
Insane since: Jan 2002

posted posted 02-03-2002 17:46

Hi everybody,
I'm working on a general sliding script that allows you to specify any layer, it's destination coordinates and the speed, and then the layer slides to this point. To finish that, I worked around with the following function to handle the horizontal movement. But this function below is very slooooooooow.
Can anybody help or even give me some reference to sliding scripts where I can learn a bit?

my end function has to be look like that

slide (slidediv,xslide,yslide,slidespeed) {blahblah}
If anybody knows a similar function, please tell me!!!


n = (document.layers) ? 1:0
ie = (document.all) ? 1:0

var id2;
function slidein () {
if (ie) {
if (document.all.displaywin.style.pixelTop<120) { document.all.displaywin.style.pixelTop += 1; }
else if (document.all.displaywin.style.pixelTop>120) { document.all.displaywin.style.pixelTop -= 1; }
window.clearTimeout(id2);
id2 = window.setTimeout("slidein()",1);
}
if (n) {
if (document.layers["displaywin"].top<120) { document.layers["displaywin"].top += 1; }
else if (document.layers["displaywin"].top>120) { document.layers["displaywin"].top -= 1; }
window.clearTimeout(id2);
id2 = window.setTimeout("slidein()",1);
}
}


cya bussman

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 02-03-2002 18:19

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 02-03-2002 19:04

Yes, setTimeout() does the action once and then stops automatically; you rarely need to clear it unless you want it to stop *before* it carries out its action. setInterval() works differently; it keeps calling the action until it is canceled.

You may also want to predeclare document.all.displaywin.style and document.layers["displaywin"] in some sort of onload function.

bussman
Obsessive-Compulsive (I) Inmate

From: the land of oz
Insane since: Jan 2002

posted posted 02-03-2002 21:05

Thanks folks for your advise!
You are right when you say that my layer is complex cos it uses the alpha transparency effect in IE.
Thanks a lot for your help!

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 02-03-2002 21:31

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

« BackwardsOnwards »

Show Forum Drop Down Menu