2011-01-12 21 views
1

カスタムスタイルの選択ボックス用のスクリプトを使用しようとしています。選択ボックスの中にたくさんの項目がありますが、スクロール機能の作成にこだわっています(数を数えるスクリプトX以上の場合は、スクリプトが作成しているULにオーバーフロー属性を渡す必要があります)。カスタムスタイルの選択ボックス

答えて

1

オーバーフロー制御のための直接的なオプションはありません。ブラウザは文書の高さを自動的に管理します。

これを行うには、jQuery Dropdown Replacementを使用し、所有しているリンクからスキンを適用します。

1

これを行うには良い方法があります。 ^^私はほんの数秒前にそれを作った;)

HTML

<div class="styledSelect"> 
       <span class="styledSelectValue"></span> 
       <select name="type"> 
        <option value="">Par type de propriété</option> 
        <option value="choix2">choix2</option> 
        <option value="choix3">choix3</option> 
       </select> 
      </div> 

CSS

.styledSelect{/*your css for the background image... it will be the body of your select*/} 
.styledSelect select{/*your css with opacity:0;*/} 
.styledSelectValue{/*the css of the received value*/} 

jQueryの

$('.styledSelect').each(function(){ 
      selectValue = $(this).children("select").val(); 
      if(selectValue == ""){selectValue = $(this).children("select").children("option:eq(0)").text();} 
      $(this).children(".styledSelectValue").text(selectValue); 
     }); 
     $('.styledSelect select').change(function(){ 
      selectValue = $(this).val(); 
      if(selectValue == ""){selectValue = $(this).children("option:eq(0)").text();} 
      $(this).parent(".styledSelect").children(".styledSelectValue").text(selectValue); 
     }); 

それは私が見つけた最良の方法です;)