繁体   English   中英

如何仅通过拖动'#head'div使'#box'可拖动,而当我拖动'#content'时不使'#box'可拖动

[英]how to make '#box' draggable only by drag the '#head' div , not make the '#box' draggable when i drag '#content'

这是我的代码:

<div id="box" style="border:1px solid red;height:100px;width:150px;position:relative;background:#eee">
        <div id="head" style="background:black">drag me</div>
        <div id="content" contenteditable=true style="border-bottom:1px solid red;height:70px;margin-bottom:5px;"> edit it </div>
        <input id="ok" type="button" value="ok"/>
        <input id="cancel" type="button" value="cancel"/>
    </div>

脚本是:

$('#box').draggable()

演示在这里: http : //jsfiddle.net/VRxZe/

谢谢

$('#box').draggable({
    handle: $('#head')
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM