2010-12-02 18 views
0

前に、私はちょうど私が私の前の質問と同様unselected.Justにしたいまで、選択したLiを述べたを保持したい:私は非選択にan anchor linkを持って、選択されていないselected li .Howへの唯一の方法は、私はでき選択されていないUIを選択するまで選択可能な状態を維持する方法はありますか?

 <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リストがULの高さをオーバーフローした場合、ULスクロールバーをクリックすると、選択されたliが選択解除されるはずです。

ありがとうございます!

答えて

0

私は上に書いたラインとしてあなたのコード.but

$(function() { 
      $("#selectable").selectable(); 
$('#unselect').click(function(event) { 
    $('#selectable').find('li').removeClass('ui-selected'); 
}); 
+0

おかげで..これを試してみてください:$( '#の選択>李')removeClass( 'UI-選択');。 – qinHaiXiang

関連する問題