ブログの投稿を表示するためにこのプラグインを使用したいと考えていますが、画像をバックグラウンドにする代わりに、クライアントは異なる色の画像を必要としています。ここの別のポストから、私はこれを行うと信じているコードを理解しましたが、それをウェブサイト上で取ることはできません!ここで私が作ったコードはここで働くようです。 Example where code is working.ポストグリッドレイアウトでランダムに異なる色の背景
ここに問題のウェブサイトがあります。 The div site where it isn't working like it should...
あなたはすべての色は、彼らが... どれでも有益な助言を大幅にこれが機能しない理由には理解されるであろうしなければならないように交互に同じではないことがわかります。
ここには、上記のjsfiddleにあるCSSとJSがあります。
CSS:.custom_tdgclients_grid{width:20%;height:90px;display:inline-block}
.custom_tdgclients_grid{background:#a7948b}
.custom_tdgclients_grid:nth-child(2n){background-color:rgb(232, 73, 73)!important;}
.custom_tdgclients_grid:nth-child(3n){background-color:rgb(83, 71, 65)!important;}
.custom_tdgclients_grid:nth-child(4n){background-color:#e8d2af!important;}
.custom_tdgclients_grid:nth-child(5n){background-color:rgb(131, 119, 113)!important;}
.custom_tdgclients_grid:nth-child(6n){background-color:rgb(216, 184, 133)!important;}
.custom_tdgclients_grid:nth-child(7n){background-color:rgb(201, 93, 93)!important;}
.custom_tdgclients_grid:nth-child(8n){background-color:#e8d2af!important;}
とJavaScript:
$('.custom_tdgclients_grid:nth-child(2n)').css({'background-color':'rgb(232, 73, 73)'});
$('.custom_tdgclients_grid:nth-child(3n)').css({'background-color':'rgb(83, 71, 65)'});
$('.custom_tdgclients_grid:nth-child(4n)').css({'background-color':'#e8d2af'});
$('.custom_tdgclients_grid:nth-child(5n)').css({'background-color':'rgb(131, 119, 113)'});
$('.custom_tdgclients_grid:nth-child(6n)').css({'background-color':'rgb(216, 184, 133)'});
$('.custom_tdgclients_grid:nth-child(7n)').css({'background-color':'rgb(201, 93, 93)'});
$('.custom_tdgclients_grid:nth-child(8n)').css({'background-color':'rgb(181, 128, 101)'});
divウェブサイトを見ると、親は何だと思いますか?彼らの素敵なワードプレスの短いコードではあまりにも多くのことが起こっていますが、どちらが親であるかわかりません。私は** n **を削除しようとしましたが、そのままコードを使用しましたが、何も変更されませんでした。 – Tyrii
これを簡略化しましたが、まだ動作していないようです。 .vc_gitem-zone.custom_tdgclients_grid:nth-child(1){背景色:#a7948b;} – Tyrii