Guy
Guy

Reputation: 67240

jQueryUI draggable outer div when clicking inner div

I've created a draggable div that works great, looks like this:

<div id="outerdiv">
   <div id="titlediv">Some Text</div>
   <div id="rowdiv">Some more text</div>
   <div id="rowdiv">Some more text</div>
</div>

in jQueryUI linked it up:

$('#outerdiv').draggable();

What I want, however, is to make the '#titlediv' draggable so that only when you click on that part can you drag the outer div.

i.e. first line inside the div is the title which when dragged will cause the whole div to drag.

Upvotes: 1

Views: 626

Answers (1)

Fr&#233;d&#233;ric Hamidi
Fr&#233;d&#233;ric Hamidi

Reputation: 262919

You can use the handle option:

$("#outerdiv").draggable({
    handle: "#titlediv"
});

Upvotes: 3

Related Questions