如何保持 UI 的选定状态为可选,直到我想取消选择?
我只想保留 li 的选定状态,直到我想取消选择为止。就像我之前的问题一样:
<style>
#feedback { font-size: 1.4em; }
#selectable .ui-selecting { background: #FECA40; }
#selectable .ui-selected { background: #F39814; color: white; }
#selectable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; }
</style>
<script>
$(function() {
$( "#selectable" ).selectable();
$('#unselect').click(function(event) {
$('#selectable>li').removeClass('ui-selected');
});
});
</script>
<div class="demo">
<ol id="selectable">
<li class="ui-widget-content"><a href="">link can not click</a></li>
<li class="ui-widget-content">Item 2</li>
<li class="ui-widget-content">Item 3</li>
<li class="ui-widget-content">Item 4</li>
<li class="ui-widget-content">Item 5</li>
<li class="ui-widget-content">Item 6</li>
<li class="ui-widget-content">Item 7</li>
</ol>
<a href="#" id="unselect">only click me to unselected</a>
</div><!-- End demo -->
我得到了取消选择的锚链接
,并且是取消选择选择的唯一方法li
。如何防止通过其他方式取消选择所选的li?
我发现如果li列表超出了UL高度,当我点击UL滚动条时,所选的li应该被取消选择。
非常感谢!
I just want to hold the selected stated of li until I want to unselected.Just Like my previous question before:
<style>
#feedback { font-size: 1.4em; }
#selectable .ui-selecting { background: #FECA40; }
#selectable .ui-selected { background: #F39814; color: white; }
#selectable { list-style-type: none; margin: 0; padding: 0; width: 60%; }
#selectable li { margin: 3px; padding: 0.4em; font-size: 1.4em; height: 18px; }
</style>
<script>
$(function() {
$( "#selectable" ).selectable();
$('#unselect').click(function(event) {
$('#selectable>li').removeClass('ui-selected');
});
});
</script>
<div class="demo">
<ol id="selectable">
<li class="ui-widget-content"><a href="">link can not click</a></li>
<li class="ui-widget-content">Item 2</li>
<li class="ui-widget-content">Item 3</li>
<li class="ui-widget-content">Item 4</li>
<li class="ui-widget-content">Item 5</li>
<li class="ui-widget-content">Item 6</li>
<li class="ui-widget-content">Item 7</li>
</ol>
<a href="#" id="unselect">only click me to unselected</a>
</div><!-- End demo -->
I got an anchor link
to unselected and the only way to unselected selected li
.How can I prevent the selected li to be unselected from other way??
I found it that the selected li should be unselecte when I click the UL scrollbar if the li list was overflow the UL height.
Thank you very much!!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个..
try this one..