Is it possible to have a Jquery Draggable object u

2019-05-28 10:09发布

I'm attempting to create a template system where an uploaded jpg is then placed on a template.

Test example:

http://www.silverink.com/TEMP/jqueryTest/

The problem is that I want to have a mask on the top most layer but be able to click and drag the lower layer. At present I'm having to either click the area to bring it to the fore then drag or have it at the fore transparent.

Any ideas or suggestions most welcome!!

3条回答
Animai°情兽
2楼-- · 2019-05-28 10:14

You are using a transparent png file for faded masking so I it's not possible to do what you are trying to. Even png is transparent in the middle still it's a part of image and block the layers below.

But you may cut that png into 4 different files and place them around this http://jsbin.com/etale4/2/edit

查看更多
神经病院院长
3楼-- · 2019-05-28 10:26

There is actually an easy way: create the draggable as usual for the occluded element, and add a mousedown event handler on the occluding image to delegate the event to the draggable:

$('#occluder').mousedown(function(ev) {
    $('#draggable').trigger(ev);
});
查看更多
Juvenile、少年°
4楼-- · 2019-05-28 10:36

Have managed to solve by creating a layer on the very top with the exact position and dimensions of the image on the lower layer. Then make top layer draggable and on the drag function update the position of the image layer.

查看更多
登录 后发表回答