The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Web Design
> JavaScript Development
|
javascript guru needed
Discuss javascript guru needed in the JavaScript Development forum on Dev Shed. javascript guru needed JavaScript Development forum discussing JavaScript and DHTML, AJAX, and issues such as coding cross-browser JavaScript.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

August 10th, 2001, 12:59 PM
|
|
Junior Member
|
|
Join Date: Aug 2001
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
javascript guru needed
ok, i'm simply making a little slider selector thing, the code is here: URL
anyway, i would like to know if there is a simple way to make it work with the postion being relative instead of absolute. is there some way to get the absolut pixel position of an image dynamically in javascript? i'm kind of new to javascript.
thanks
|

August 10th, 2001, 01:32 PM
|
|
Contributing User
|
|
Join Date: Jun 2001
Location: Toronto, Ontario, Canada
Posts: 631
Time spent in forums: 7 m 19 sec
Reputation Power: 12
|
|
|
Whats the advantage of having it relative? The way it is is fine... change the 'return true' to 'return false' in the mouseMove() function. If it doesnt work, change it back. That should get rid of being able to highlight areas of the document while you're dragging the dropper.
|

August 12th, 2001, 07:51 PM
|
|
Junior Member
|
|
Join Date: Aug 2001
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
thanks for the mouse move tip, that woked...
the reason i want the postion to be relative is because i have a page with some graphs that can be different sizes and the position of the slider will not always be the same. if there's no way to do it with the position being relative that's fine but i just want to make sure i can't do it with the slider first.
|

August 12th, 2001, 10:28 PM
|
|
Contributing User
|
|
Join Date: Jun 2001
Location: Toronto, Ontario, Canada
Posts: 631
Time spent in forums: 7 m 19 sec
Reputation Power: 12
|
|
|
Change the position:absolute; property for ALL the divs to position:relative;
Add:
left:#;top#;
That will give you a # of pixels offset to the div's static position.
|

August 12th, 2001, 10:48 PM
|
|
Junior Member
|
|
Join Date: Aug 2001
Posts: 3
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
thanks for the suggestion but i've already tried that. the problem happens when i do something like this:
domRed.xpos = parseInt(domRed.left);
this then takes the left of red (be it relative or absolute) and assumes it's an absolute position. this is my problem, maybe i just haven't stated my question clearly enough before, for that i am sorry.
i'm just wondering if there is a way in javascript to get the absolute position of an image on a page after i have placed the div as relative...if you can't do that would there be a way to make my slider code respect the relative positions of my divs?
thanks for all your help so far
Last edited by G-funk : August 12th, 2001 at 10:52 PM.
|

August 13th, 2001, 10:04 AM
|
|
Contributing User
|
|
Join Date: Jun 2001
Location: Toronto, Ontario, Canada
Posts: 631
Time spent in forums: 7 m 19 sec
Reputation Power: 12
|
|
|
You could put the image in a layer, and with javascript, use absolute positioning to position the slider.
This is for IE only:
<script language="javascript">
function position() {
document.all["div2"].style.top=document.all["div1"].style.top+document.all["div1"].style.height+50;
}
</script>
That would give you 50px between the image and the slider div.
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|