I have an unusual situation while setting the draggable - the problem
is that containment is smaller than the draggable object. So the
draggable is visible through a "window", and the window is the
containment.
If I just set containment to that "window", trying to move the object
results in snapping object to it's lower right corner. Is there some
way to fix that behaviour?
I even tried to understand and edit the jquery-ui source code to add
this functionality, but I don't have enough experience and knowledge
in JavaScript, so it didn't work in Opera 9.2x,   but works in Opera
9.5. In Opera 9.2x draggable can be moved only horizontally.
My attempt:

                if(this.containment) {
                        /* //unchanged source version
                        if(position.left < this.containment[0]) position.left =
this.containment[0];
                        if(position.top < this.containment[1]) position.top =
this.containment[1];
                        if(position.left > this.containment[2]) position.left =
this.containment[2];
                        if(position.top > this.containment[3]) position.top =
this.containment[3];
                        */

                        // - changed source -
                        if ($(o.containment).height() > this.helper.height()) {
                                if(position.top < this.containment[1]) 
position.top =
this.containment[1];
                                if(position.top > this.containment[3]) 
position.top =
this.containment[3];
                        } else {
                                if(position.top > this.containment[1]) 
position.top =
this.containment[1];
                                if(position.top < this.containment[3]) 
position.top =
this.containment[3];
                        }

                        if ($(o.containment).width() > this.helper.width()) {
                                if(position.left < this.containment[0]) 
position.left =
this.containment[0];
                                if(position.left > this.containment[2]) 
position.left =
this.containment[2];
                        } else {
                                if(position.left > this.containment[0]) 
position.left =
this.containment[0];
                                if(position.left < this.containment[2]) 
position.left =
this.containment[2];
                        }
                        // - end of changed source -

                }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to