Reputation: 78
How to make the iframe follow the mouse cursor as soon as the drag (of any object eg. image, text, etc.) is started?
Thanks in advance.
Upvotes: 0
Views: 636
Reputation: 28366
Usually mouse events from elements inside an iframe don't propagate to the frame itself. You can add handlers to the elements inside the frame to do trigger the necessary events on the iframe.
A simple example using jQuery UI:
var $els = $("*", frames['frame'].document );
$els.bind("mousedown mousemove mouseup",function(e) { $('#frame').trigger(e); })
$els.bind("drag",function(e) { $('#frame').trigger(e); return false; });
$('#frame').draggable();
Upvotes: 1