6

modernizr のように (実際にはそうではありません)、「古いブラウザー」(ポリフィル) のフレックスボックスを有効にする JavaScript ライブラリを探しています。

はい、これは本当に新しい機能であることは知っています (事実、「存在しない」というのは有効な答えです)。しかし、私はこのようなことを望んでいます。私は常に水平方向と垂直方向のセンタリングに苦労しています。作品。

私はこのフレックスボックスを意味します: http://weblog.bocoup.com/dive-into-flexbox/ (最新)

4

2 に答える 2

4

これには時期尚早かもしれません。WebKit はかなり最近実装されました。どのモバイル WebKit にもサポートの兆候はまったくありません。Opera はそのサポートをリリースしたばかりで、Gecko の実装はまだアルファ版です。いいえ?はぁ。

しかし、私が知る限り、いいえ、新しいフレックスボックス用のポリフィルはありません。 Flexieは古い flexboxをサポートしており、新しい構文をサポートするためのチケットが公開されています。

いつでも古いフレックスボックスを使用できると思いますが、そうするとすぐに時代遅れになります。やばい状況。

于 2013-01-18T00:00:37.963 に答える
1

自分で作成する必要があります。 http://www.sitepoint.com/detect-css3-property-browser-support/には、「独自の検出コードのローリング」というタイトルのセクションがあります。

基本的に、次のようなものが必要です。

// detect CSS display:flex support in JavaScript
var detector = document.createElement("detect");
detector.style.display = "flex";
if (detector.style.display === "flex") {
    console.log("Flex is supported");
}
else
{
    console.log("Flex is not supported");
}

それを拡張して関数を作成するには:

function DetectDisplayValue(val)
{
  // detect CSS display:val support in JavaScript
  // 
  var detector = document.createElement("detect");
  detector.style.display = val;
  if (detector.style.display === val) {
    console.log("Display value: " + val + " is supported");
  }
  else
  {
      console.log("Display value: " + val + " is not supported");
  }
}
于 2013-01-17T23:16:02.470 に答える