最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - jquery sortable except this one - Stack Overflow

programmeradmin4浏览0评论

Need a way to allow sorting except for last item with in a list.

Tried using the cancel option but it didn't work and I don't think that's what its for.

I think a solution may be with events but would like your take on it.

In practice the list is dynamically generated and relies on tag and relative referencing not id's for selecting.

Sample code:

$("ul").sortable({});
...
<ul>
<li>red</li>
<li>blue</li>
<li>white</li>
<li>black</li>
<li>this li should not be sorted</li>
</ul>

Browser is Internet Explorer 6.

Need a way to allow sorting except for last item with in a list.

Tried using the cancel option but it didn't work and I don't think that's what its for.

I think a solution may be with events but would like your take on it.

In practice the list is dynamically generated and relies on tag and relative referencing not id's for selecting.

Sample code:

$("ul").sortable({});
...
<ul>
<li>red</li>
<li>blue</li>
<li>white</li>
<li>black</li>
<li>this li should not be sorted</li>
</ul>

Browser is Internet Explorer 6.

Share Improve this question edited Dec 25, 2016 at 9:36 chrki 6,3236 gold badges38 silver badges59 bronze badges asked Nov 11, 2008 at 22:23 jason saldojason saldo 9,9505 gold badges35 silver badges41 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 25
$("ul").sortable( { items: "> li:not(:last)" } );
发布评论

评论列表(0)

  1. 暂无评论