We managed to resolve this issue by implementing mouse event listeners on the overlay div and then forwarding those events to the image beneath it. Whenever the PNG overlay ("#frame")
is clicked, the click event is directed to the underlying image ("#imageid")
. This approach allows us to make the underlying image draggable without any interference from the overlay.
$(function() {
$( "#imageid" ).draggable();
});
$(document).ready(function () {
// Attach necessary events to the #frame element.
$("#frame").bind("click", function (event) {
proxy(event);
});
$("#frame").bind("mousedown", function (event) {
proxy(event);
});
$("#frame").bind("mouseup", function (event) {
proxy(event);
});
$("#frame").bind("mousemove", function (event) {
proxy(event);
});
});
function proxy(event) {
$("#imageid").trigger(event);
}
The HTML structure would look like:
<div id="image">
<img id="imageid" src="imageToDrag.jpg" style="position: relative; visibility: visible;">
</div>
<div id="frame">
<img src="overlay.png" style="position: absolute;top: 0;left: 0; height: 100px; width: 100px;"/>
</div>