开发者

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

开发者 https://www.devze.com 2023-01-27 10:02 出处:网络
this is my code : <div id=\"box\" style=\"border:1px solid red;height:100px开发者_如何学JAVA;width:150px;position:relative;background:#eee\">

this is my code :

<div id="box" style="border:1px solid red;height:100px开发者_如何学JAVA;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>

and the script is :

$('#box').draggable()

the demo is here :http://jsfiddle.net/VRxZe/

thanks


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号