Helpful Information
 
 
Category: JavaScript Development
DHTML problem

Hi people,

I'm just starting with DHTML and got a problem. It's kinda hard to explain, but I'm working with slideouts, and when a slideout disappears and the other should come, the next slideout first pop-ups for a moment before loading. If nobody understands the question, which I can imagine, the html document is on http://home.wanadoo.nl/joop/DHTML/Dhtml.html.
Please help me! http://www.devshed.com/Talk/Forums/frown.gif

Hi ReareFreak - your page was not working so I can not see what is going on there - the source did not help much either -

Anyway a general tip is to hide all layers in tour init function and only make them visible the very instant that they are needed
if the layers are to slide in from offscreen - make sure that they are positioned offscreen before the visibility is turned on .

Sorry I could be of no further help.

------------------
Simon Wheeler
FirePages -DHTML/PHP/MySQL

I'm sorry, put a dot to much in the URL http://www.devshed.com/Talk/Forums/frown.gif
I didn't optimize it for NS yet, but in IE it should work fine on this URL: http://home.wanadoo.nl/joop/DHTML/Dhtml.html
Thanx for your looking.

The problem is that the div gets shown before the slide function begins - the code below solves the problem - but is not very efficient - but at least you know where the problem lies (it does work - I tested it)

function slideoutLeft() {
if (slideoutShown.xpos > -700) {
slideoutShown.xpos -= 30
slideoutShown.left = slideoutShown.xpos
setTimeout("slideoutLeft()",20)
}
else {
hide(slideoutShown)
//show(slideoutNew)//## FROM HERE
setTimeout("slideoutRight()",20)
}
}

function slideoutRight() {
show(slideoutNew)//###### TO HERE
if (slideoutNew.xpos < 0) {
slideoutNew.xpos +=20
slideoutNew.left = slideoutNew.xpos
setTimeout("slideoutRight()",20)
}
else {
slideoutShown = slideoutNew
slideoutActive = 0
}
}

This is not good coding as it forces a show() every time in the loop - but it works for now. Your code 'appears' to position everything off screen but manages to move it onscreen again just before the slide - mess around with that for a bit.


regards
Simon



------------------
Simon Wheeler
FirePages -DHTML/PHP/MySQL










privacy (GDPR)