PDA

View Full Version : draggable box woes



Antoniohawk
01-20-2003, 03:04 AM
Go to http://www.angelfire.com/art2/pssite/test.html. See my box? Well i want it to be able to be draggable, but i can drag anywhere on the page and it moves. I only want it to move when i am clicking on it. When i made the <div> exactly the same size as the box, when i tried to drag it, it tried to drag the images that its made of. Any suggestions would be great.

Vladdy
01-20-2003, 03:42 AM
That's some ugly, IE only drag code, that will fail when the page is scrolled.
Suggestion: start from scratch.

Antoniohawk
01-23-2003, 03:34 AM
yeh ur right, if i figure it out, then i will know how to work with it.

Vladdy
01-23-2003, 04:34 AM
Something I've been playing with, that you may find helpfull:
http://www.vladdy.net/wca/wintest.html

brothercake
01-23-2003, 02:59 PM
Originally posted by Vladdy
Something I've been playing with, that you may find helpfull:
http://www.vladdy.net/wca/wintest.html

Very cool ... but you know you could go further with that ... draggable elements which also flow with the page - not absolutely positioned at all ... ;)

Vladdy
01-23-2003, 06:22 PM
Originally posted by brothercake
Very cool ... but you know you could go further with that ... draggable elements which also flow with the page - not absolutely positioned at all ... ;)

As I said this is work in progress. I'm not sure, though, that I would take it the way you suggested i.e. going away with absolute positioning. In the majority of cases (the way I see it) dragging an element means taking it out of normal flow, which implies absolute positioning.

Antoniohawk
01-24-2003, 04:02 AM
thats pretty kewl man, ill check with that when i start working on my box again.

brothercake
01-24-2003, 12:20 PM
Originally posted by Vladdy
In the majority of cases (the way I see it) dragging an element means taking it out of normal flow, which implies absolute positioning.


Yes it does .. but here's what you can do:

1 - draw the inital elements as normal HTML; the elements flow as normal, and no resize/reloading is necessary

2 - when you click on the active part of the box, the original (HTML) box is hidden, and you createElement an entirely new, absolutely-positioned element, which is positioned in the same place (using a recursive offsetWidth/offsetHeight finding function) and you write into it the same innerHTML ... the users never know it isn't the same DIV

3 - when you let go of it, the element is destroyed, and you simply re-show and the re-arrange the node order of the original element :D

Vladdy
01-24-2003, 06:49 PM
I can do a lot of things, first I gotta figure out what to do them for :D :D
Seriously, if there is a project where such approach can be useful I would do it, but I have not come across one yet...
What I'm conceptualizing now is bringing the 3rd dimension to the commonly used "2d" layout we inherited from <TABLE> age and this "desktop" approach is one of them.

your step 2: Actually I would not have to recreate the element, just remove it from the original parent and attach to the document.body changing position to absolute...