#3078 closed bug (worksforme)
Containment dimensions calculation bug in msie 7
Reported by: | Owned by: | paul | |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | ui.draggable | Version: | 1.5.1 |
Keywords: | containment fix position dimension ie7 | Cc: | |
Blocked by: | Blocking: |
Description
When using a contianment with the draggable plugin like this:
var me=this; var onchange=function(e) { me.onChange(e); }; var options={ axis:"y", opacity:0.6, containment:this.getDayNode(), start:function(e) { me.widget.currentDraggedHandle=me;onchange(e); }, stop:function(e) { me.widget.currentDraggedHandle=null;me.updateUI(true);onchange(e); }, drag:onchange, snap:"div.timepointHandle.handleInDay"+this.t.dayOfWeek+".handleInGroup"+this.groupUi.group.id, snapMode:"outer", snapTolerance:3 }; this.node.draggable(options);
Then you have a problem if there are enough element above the containment element. (be sure to have some tables and divs above the contianment).
A have a solution to the jquery.draggable plugin: I changed the following code:
if(!(/^(document|window|parent)$/).test(o.containment)) { var jQ=$(o.containment); var ce = jQ[0]; var co = jQ.offset(); this.containment = [ co.left+(parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left, co.top+(parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top, co.left+Math.max(ce.scrollWidth,ce.offsetWidth) - (parseInt($(ce).css("borderLeftWidth"),10) || 0) - this.offset.relative.left - this.offset.parent.left - this.helperProportions.width - this.margins.left - (parseInt(this.element.css("marginRight"),10) || 0), co.top+Math.max(ce.scrollHeight,ce.offsetHeight) - (parseInt($(ce).css("borderTopWidth"),10) || 0) - this.offset.relative.top - this.offset.parent.top - this.helperProportions.height - this.margins.top - (parseInt(this.element.css("marginBottom"),10) || 0) ]; }
To the following code (requires the dimensions plugin)
if(!(/^(document|window|parent)$/).test(o.containment)) { var jQ=$(o.containment); var ce = jQ[0]; var co = jQ.offset(); this.containment = [ co.left, co.top, co.left+jQ.width()-this.element.width(), co.top+jQ.height()-this.element.height() ]; }
Change History (3)
comment:1 Changed 14 years ago by
Milestone: | → TDB |
---|
comment:2 Changed 14 years ago by
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
I wasn't able to reproduce the issue. Could you produce a test page for me if it still happens? Thanks, Paul