This problem has also been raised in the issue tracker (id 37) and I have added a comment to that issue that explains why it is happening, and how I fixed it.
From Issue 37 :
I can give you a reason/solution on this one because I've just found the same problem
and resolved it in my v1.0 code (@version SVN: $Id: shadowbox.js 75 2008-02-21
getDimensions() returns the width with extra_body_width added to it, ie. it adds in
shadowbox_body margins and borders.
When positionDrag() compares current_width with optimal_width they should be the same
(if width fits within the shadowbox!) but aren't because of these borders/margins
that are included in current_width but not optimal_width.
Because extra_body_width is presumably added to width for a good reason, I fixed this
by changing resetDrag() to add xAdj to the drag object, with xAdj containing the same
borders and margins from shadowbox_body; then I changed positionDrag() to subtract
drag.xAdj from current_width.