簡體   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