4

SelectBoxIt.js で幅 100% の選択ボックスを作成する際に問題が発生します

CSS 幅を 100% に設定しても、選択ボックスはコンテナー要素の 100% を埋めません。

CSS:

.test1, .test2, .test2 .selectboxit, .test2 .selectboxit-options {
  width: 100%;
}

HTML:

<select name="test2" class="test2">
  <option value="SelectBoxIt is:">SelectBoxIt is:</option>
  <option value="a jQuery Plugin">a jQuery Plugin</option>
  <option value="a Select Box Replacement">a Select Box Replacement</option>
  <option value="a Stateful UI Widget">a Stateful UI Widget</option>
</select>
4

2 に答える 2

10

js

$(".mySelect").selectBoxIt({ autoWidth: false });

そしてcss

.selectboxit-container {
    width: 100%;
}

    .selectboxit-container .selectboxit {
    width: 100%;
}
于 2014-04-27T10:42:55.820 に答える
5

Greg Franko が問題の解決を手伝ってくれました。

JSBin で解決策を確認できます。 http://jsbin.com/udapic/1/edit

基本的に、次のように autoWidth を無効にする必要があります。

$(".test2").selectBoxIt({ autoWidth: false, copyClasses: "container" });

次に、CSS で幅を 100% に設定します。

.test1, .test2, .test2 .selectboxit, .test2 .selectboxit-options { width: 100%; }

于 2013-08-16T08:53:21.463 に答える