Good question.  I can only guess that Draggables is probably using
offsets to build the containment box and AFAIK, this does not take into
account padding (and it shouldn't).  The use of offsets was more than
likely also the cause of the initial bounding issue you had.  Even
though you repositioned the parent using margins, since it was not
relatively or absolutely positioned, the call to get parent offset was
returning the parent's initial location minus the margin adjustment.
WARNING: These are all just wild guesses off the top of my head, though.
I could be completely wrong ;)

 

-scott

 

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Gord Busse
Sent: Thursday, March 08, 2007 12:25 PM
To: jQuery Discussion.
Subject: Re: [jQuery] Interface Draggables Problem

 

Scott,

Thanks, you rock! I knew it had to be something simple.

One more question though. Any idea why it ignores my padding: 10px;
setting on the parent element?

Thanks again,
Gord



On 3/8/07, Weaver, Scott <[EMAIL PROTECTED]> wrote:

Ah, easy fix.  I went ahead and mimicked your site.  All you need to do
to fix this is to set the parent element, #page in your case,
position:relative.  Now it works like a charm!

 

hth,

-scott

 

________________________________

From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ] On Behalf Of Gord Busse
Sent: Thursday, March 08, 2007 9:52 AM
To: JQuery Discuss
Subject: [jQuery] Interface Draggables Problem

 

Greetings,

I am new to JQuery and am very excited to start using it and jump into
the world of javascript programming. I have been experimenting with the
Interface plugins and have come across a problem or possible bug with
the Draggable library. Please see the following page: 

http://www.gordbusse.com/test.htm

I have a parent div horizontally centered on the page using:

margin-right: auto;
margin-left: auto;

And have a child div inside that set to be draggable. But the draggable
div does not appear to be obeying the containment: 'parent' command and
staying within the div. In fact it seems that there is a constraint but
the constraint is left justified whereas the parent div is centered?
Furthermore the draggable child div also appears to be ignoring the
padding setting of the parent div as well? 

If I take out the auto margin settings to make the parent div left
justified it looks better but it still doesn't seem to be working right?

Am I doing something wrong or is this a bug?

Thanks in advance for any help anyone can give me. 

Gord


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

 

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to