是否有可能在另一个div下有一个Jquery Draggable对象 [英] Is it possible to have a Jquery Draggable object under an other div

查看:85
本文介绍了是否有可能在另一个div下有一个Jquery Draggable对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个模板系统,然后将一个上载的jpg放置在模板上.

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

测试示例:

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!!

推荐答案

实际上有一种简单的方法:像往常一样为被遮挡的元素创建可拖动对象,并在遮挡图像上添加mousedown事件处理程序,以将事件委托给可拖动的:

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);
});

这篇关于是否有可能在另一个div下有一个Jquery Draggable对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆