Closed Thread Icon

Topic awaiting preservation: moving Layers ? Pages that link to <a href="https://ozoneasylum.com/backlink?for=8291" title="Pages that link to Topic awaiting preservation: moving Layers ?" rel="nofollow" >Topic awaiting preservation: moving Layers ?\

 
Author Thread
CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 08-31-2002 17:48

Can someone look at this page:
http://home.mindspring.com/~curtadkins/dHTML/

And tell me *why* that when you click on one of the links, the DIV restarts at the top of the page and then moves?

Thanks in advance.

Later,
C:\


~Binary is best~

mr.maX
Maniac (V) Mad Scientist

From: Belgrade, Serbia
Insane since: Sep 2000

posted posted 08-31-2002 18:05

In order to read initial CSS values, you must specify them directly in <DIV> tag via STYLE attribute... Like this:

<div id="cDiv" style="position:absolute;left:100;top:100;padding:10px;border:1px solid #000000;background-color:red;">TEST</div>

In addition to that, you also need to modify your code setSlider() function:

var curX = parseInt(myObj.left);
var curY = parseInt(myObj.top);

Calling parseInt() function is needed because, standards complaint web browsers will actually return string (i.e. "100px") instead of number...


CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 08-31-2002 18:13

Thank you very much. I'm off to try it.

quote:
Calling parseInt() function is needed because, standards complaint web browsers will actually return string (i.e. "100px") instead of number...



That was a lot of help DOH!

Later,
C:\


~Binary is best~

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 08-31-2002 18:18

OK, just tried it and it worked great.

I am just a little confused about the style calling from the acutal div instead of a style tag.

So the JavaScript can't read the initial values from a style sheet? That's weird. I always kind of thought that that is what dHTML did.

Man, this is starting to sink in but then again it also starts to get more difficult.

Thanks again for the help!

Later,
C:\


~Binary is best~

Slime
Lunatic (VI) Mad Scientist

From: Massachusetts, USA
Insane since: Mar 2000

posted posted 08-31-2002 19:17

I believe there's a currentStyle property that holds the current calculated style information of an element. I'm not sure how standard this is, though.

« BackwardsOnwards »

Show Forum Drop Down Menu