Skip to main content

Search and Top Navigation

#3078 closed bug (worksforme)

Opened July 09, 2008 08:31PM UTC

Closed September 16, 2008 10:44AM UTC

Last modified October 11, 2012 09:15PM UTC

Containment dimensions calculation bug in msie 7

Reported by: tjerkw@gmail.com 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()
				];
			}
Attachments (0)
Change History (3)

Changed August 17, 2008 09:56AM UTC by Cloudream comment:1

milestone: → TDB

Changed September 16, 2008 10:44AM UTC by paul comment:2

resolution: → worksforme
status: newclosed

I wasn't able to reproduce the issue. Could you produce a test page for me if it still happens? Thanks, Paul

Changed October 11, 2012 09:15PM UTC by scottgonzalez comment:3

milestone: TBD

Milestone TBD deleted