Opened 12 years ago

Closed 11 years ago

Last modified 7 years ago

#7925 closed bug (notabug)

droppable prepareOffsets sets incorrect offset when droppable is in an iframe

Reported by: reevesm Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.droppable Version: 1.8.14
Keywords: Cc:
Blocked by: Blocking:

Description

version: jquery-ui-1.8.14 browser: chrome os: windows

To reproduce:

  1. Create a draggable element using jQueryUI draggable API outside of your iframe
  2. Create droppable elements within an iframe (iframe is in middle of the page) on the same page and alert when element is dragged over the droppable within the iframe.

var body = $('#iframe').contents().find('body'); $(body).droppable({

over:function(event,ui) {

alert('over droppable');

}

});

Result: The alert will not fire when dragging over the iframe but will fire when the element is dragged into a position above the iframe

Expected Result: The alert fires when dragging over the body element in the iframe.

See $.ui.ddmanager.prepareOffsets. It appears that m[i].offset is incorrect.

Change History (12)

comment:1 Changed 11 years ago by Scott González

Resolution: invalid
Status: newclosed

We don't support cross-window dragging.

comment:2 Changed 11 years ago by ddphoto

I had implemented a workaround to enable drag&drop with iframe. in $.ui.ddmanager.prepareOffsets I change the offset to handle the iframe scrolling & the iframe position.

juste after m[i].offset = m[i].element.offset();

  // handle iframe scrolling
  m[i].offset.top -=  m[i].element.parents().find("html,body").scrollTop();
  m[i].offset.left -=  m[i].element.parents().find("html,body").scrollLeft();

  // iframe positioning 
  if( this.current.options.iframeOffset )
  {
    m[i].offset.top +=  this.current.options.iframeOffset.top;
    m[i].offset.left +=  this.current.options.iframeOffset.left;
  }

where iframe offset come from the draggable option like

$( "div" ).draggable({
  iframeFix: true, 
  appendTo: 'body',
  containment: 'window',
  helper: "clone",
  iframeOffset: $("#frame").offset()
 });

Tested on FF 8.0.1 & Chrome 16

comment:3 Changed 10 years ago by Scott González

#9421 is a duplicate of this ticket.

comment:4 Changed 8 years ago by Scott González

#11204 is a duplicate of this ticket.

comment:5 in reply to:  4 Changed 8 years ago by gaurav

Replying to scott.gonzalez:

#11204 is a duplicate of this ticket.

Hello scott.gonzalez,

Could you please visit ticket number 11204 its not duplicate of 7925. I still getting issue. when iframe document reloads in IE10.

Please look into it once again and open the ticket.

Thanks Gaurav Teli

comment:6 Changed 8 years ago by Scott González

Please read the first comment on this ticket and look at the status of the ticket. Regardless of whether this happens to work in Chrome right now, this is not something we support.

comment:7 Changed 8 years ago by Scott González

#11222 is a duplicate of this ticket.

comment:8 in reply to:  6 Changed 8 years ago by gaurav

Replying to scott.gonzalez:

Please read the first comment on this ticket and look at the status of the ticket. Regardless of whether this happens to work in Chrome right now, this is not something we support.

Hello Scott.Gonzalez:

I am very much agree with you. I want to say it's working first time as expected. So It should work on 2nd time rendering also.

I am struck in key task. If possible please try to put some focus or guide me.

Thanks Gaurav

comment:9 Changed 7 years ago by Scott González

#14906 is a duplicate of this ticket.

comment:10 Changed 7 years ago by Scott González

#14953 is a duplicate of this ticket.

comment:11 Changed 7 years ago by Scott González

#14964 is a duplicate of this ticket.

comment:12 Changed 7 years ago by Scott González

#15047 is a duplicate of this ticket.

Note: See TracTickets for help on using tickets.