Connecting Tech Pros Worldwide Forums | Help | Site Map

drag within scrollable div

Andrew Poulos
Guest
 
Posts: n/a
#1: Aug 25 '08
How do I make an object that's within a DIV, whose overflow style is set
to "auto", draggable? I've had a number of goes but the ways I've tried
depend on absolutely positioning the object which means it gets dragged
"out" of the DIV.

It doesn't matter how far a user drags the object.

Andrew Poulos

Gregor Kofler
Guest
 
Posts: n/a
#2: Aug 25 '08

re: drag within scrollable div


Andrew Poulos meinte:
Quote:
How do I make an object that's within a DIV, whose overflow style is set
to "auto", draggable? I've had a number of goes but the ways I've tried
depend on absolutely positioning
Why? Position it relatively.


Gregor


--
http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
http://web.gregorkofler.com ::: meine JS-Spielwiese
http://www.image2d.com ::: Bildagentur für den alpinen Raum
Andrew Poulos
Guest
 
Posts: n/a
#3: Aug 25 '08

re: drag within scrollable div


Gregor Kofler wrote:
Quote:
Andrew Poulos meinte:
Quote:
>How do I make an object that's within a DIV, whose overflow style is
>set to "auto", draggable? I've had a number of goes but the ways I've
>tried depend on absolutely positioning
>
Why? Position it relatively.
Yep, you're right. It needed to be positioned but not necessarily
absolutely.

Andrew Poulos
Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
#4: Aug 25 '08

re: drag within scrollable div


Andrew Poulos wrote:
Quote:
How do I make an object that's within a DIV, whose overflow style is set
to "auto", draggable? I've had a number of goes but the ways I've tried
depend on absolutely positioning the object which means it gets dragged
"out" of the DIV.
>
It doesn't matter how far a user drags the object.
The positioning scheme of a dragable object does not really matter as long
as you calculate its new position as its old position plus the difference
between the new and old cursor coordinates, while keeping the positioning
scheme (except setting "static" to "relative"). It appears that this is
also the most efficient and most compatible approach.


HTH

PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Closed Thread