Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mouseup event on document is not fired after hovering over iframe

I am trying to get a div splitter working to resize two divs when I drag the splitter. I am trying to do this with mousedown, mousemove and mouseup events. It works like a charm until I add my youtube iframe. Once I hover over the iframe the mouseup event to $(document) is not fired, I'm guessing it is taken by the iframe. I have a working example in jsfiddle.

In the example the mouseup event is fired until your mouse moves over the iframe.

like image 677
ajaali Avatar asked Oct 01 '15 10:10

ajaali


2 Answers

Here's a work around, ugly but should work, while dragging the mouse put an invisible div with a higher z-index on top of the iframe and when the dragging stops you remove it (or set a lower z-index to move it under the iframe). This div will catch your mouse events instead of the iframe.

like image 172
slash197 Avatar answered Sep 30 '22 11:09

slash197


You can apply the pointer pointer-events: none style to iframe during mousemove event.

like image 38
daniil_ Avatar answered Sep 30 '22 12:09

daniil_