interact.js icon indicating copy to clipboard operation
interact.js copied to clipboard

Drag an element under another element

Open julian0852 opened this issue 10 years ago • 2 comments

I have two divs - position:absolute directly over each other. Div1 is zindex:1 contains an image of a face Div2 is zindex:2 contains a png image of birthday card with transparent "hole" Therefore the face is visible through the "hole" I need to be able to drag the face around but leave the birthday card on top. But when I make Div1 draggable it cannot be dragged because Div2 is on top and therefore cannot be touched. Is there a way around this? Maybe drag Div1 when Div2 is touched?

julian0852 avatar Sep 30 '16 12:09 julian0852

That may be the best way, as long as you're fine with the birthday card not being draggable.

Just make an interact targetting Div2 that makes changes to Div1.

dpekkle avatar Oct 08 '16 14:10 dpekkle

You can also set CSS pointer-events: none on the birthday card so that all pointer interactions go right through it and to the face.

taye avatar Nov 28 '16 21:11 taye