Netra
Netra

Reputation: 13

jQuery-UI Disable dragging for some elements

I am making a desktop-like website, and I want to drag my windows around. I am using jQuery-UI and .draggable(). My current code looks like this:

<div id="window"> <!-- You'll drag this whole div -->
    <div id="title">Window name</div> <!-- You drag with this -->
    <div id="content"></div> <!-- You cannot drag this -->
</div>

And with my JS I just did this:

$("#window").draggable();

I want this because I need to select text from #content, which is hard to do if it's draggable.

Upvotes: 1

Views: 3253

Answers (2)

kdureidy
kdureidy

Reputation: 960

I guess you need this

$("#window").draggable({ handle: "title" });

Upvotes: 0

Matt Maclennan
Matt Maclennan

Reputation: 1304

The code I think should be...

$("#content").draggable('disable');

There was a similar question to this here... jquery disable dragging

Upvotes: 1

Related Questions