How to keep the selected state of UI Selectable until I want to unselected?
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!!
try this one..
$(function() {
$( "#selectable" ).selectable();
$('#unselect').click(function(event) {
$('#selectable').find('li').removeClass('ui-selected');
});
精彩评论