acushla
acushla

Reputation: 83

how to disable dragging behaviour for some of the sortable elements

I have following div elements and I would like to sort only elements which don't have class="nodragorsort".

<div id="1" class="one">
    <div>one </div>
    <div class="nodragorsort">this should be fixed </div>
    <div class="nodragorsort">this should be fixed </div>
    <div>one </div>
</div>

Am connecting multple divs using connect with in jQuery sortable. I want some of elements present in a div not to connect with other sort divs and not even user can drag those elements those elements index should be fixed or need to make fixed.

Upvotes: 0

Views: 3033

Answers (1)

Arun P Johny
Arun P Johny

Reputation: 388316

You can use items option to specify which elements can be sorted

$('.one').sortable({
    items: '> :not(.nodragorsort)'
})

Demo: Fiddle

Upvotes: 8

Related Questions