블로그 게시물을 표시하는 데이 플러그인을 사용하고 싶지만 이미지를 배경으로 사용하는 대신 클라이언트가 다른 색상의 이미지를 원합니다. 여기에있는 다른 게시물에서 나는 이것을 수행한다고 믿는 코드를 알아 냈지만 웹 사이트에서 가져올 수는 없습니다. 여기 내가 만든 코드가 여기에서 작동하는 것 같습니다. 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;}
그리고 자바 스크립트 :
$('.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) {background-color : # a7948b;} – Tyrii