マウスを持っていくとカラーになる設定は、style.cssの以下の部分
/*グレイスケール 画像ありの仕組み*/
.blog .hentry a .attachment-post-thumbnail,
.archive .hentry a .attachment-post-thumbnail,
.search .hentry a .attachment-post-thumbnail {
border-radius: 180px;
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
-webkit-filter: grayscale(1); /* Older versions of webkit */
-moz-filter: grayscale(100%);
-o-filter: grayscale(100%);
-ms-filter: grayscale(100%); /* IE 10 */
filter: gray; /* IE 9 */
filter: url('inc/desaturate.svg#greyscale'); /* Firefox */
opacity: .8;
-webkit-opacity: .8;
-moz-opacity: .8;
transition: all .3s ease-in-out;
-webkit-transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
-o-transition: all .3s ease-in-out;
-ms-transition: all .3s ease-in-out;
width: 100%;
height: 100%;
z-index: 1;
}
関連のヒント
チャイルドテーマのstyle.css
、
/* サークルの文字色*/
.hentry.no-thumbnail span{
color:green;
}
/*マウスを乗せた色 テキスト*/
.hentry.no-thumbnail span:hover{
color:yellow;
}
/*サークル背景色の変更 画像なしの*/
.hentry.no-thumbnail {
background:#FFCC99;
}
nobitaさん、それぞれの質問にアドバイスくださってありがとうございます。
上記、せっかく頂いた回答ですが、初心者の私には「???」でした。すみません。
チャイルドテーマのスタイルシートは、ネットでいろいろ調べながら作ったのですが、どのサイトでもオリジナルテーマのスタイルシートをすべてコピーしてくるのではなく、中身は以下の部分だけで作成と書いてあったので、現在チャイルドテーマのスタイルシートは、nobitaさんに別記事でアドバイス頂いたフッターの部分を加えて、このようになっています。
@charset “utf-8”;
/*
Theme Name:spun-child
Template:spun
*/
@import url(‘http://reikoausten.lolipop.jp/wp-content/themes/spun/style.css’);
/* フッター中央そろえ */
.site-info{
text-align:center;
}
この問題を解決するには、オリジナルのスタイルシートを全部(または上記の該当部分のみ?)コピーして、編集するのでしょうか。
また、ヒントとして頂いた.hentry.no-thumbnail {は該当部分には見当たりませんが、これらは追加するということでしょうか?
以下が、実際の表示変更をテストしたスタイルシートです。
チャイルドテーマの、style.cssです。
Theme Name: spun child は、現在作っているチャイルドテーマ名に変更してください。
/*
Theme Name: spun child
Template:spun
*/
@import url("../spun/style.css");
/* フッター中央そろえ */
.site-info{
text-align:center;
}
/* ページのサイトタイトル */
.page .site-title{
/* 表示 非表示*/
/*display:none;*/
font-family:sans-serif;
font-style:normal;
}
/* サークルの文字色*/
.hentry.no-thumbnail span{
color:green;
}
/*マウスを乗せた色 テキスト*/
.hentry.no-thumbnail span:hover{
color:yellow;
}
/*サークル背景色の変更 画像なしの*/
.hentry.no-thumbnail {
background:#FFCC99;
}
/*グレイスケール 画像ありの仕組み*/
.blog .hentry a .attachment-post-thumbnail,
.archive .hentry a .attachment-post-thumbnail,
.search .hentry a .attachment-post-thumbnail {
border-radius: 180px;
/* モノクロ表示のルール スタート 100% を 50% 1を.5等に変えてみて*/
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
-webkit-filter: grayscale(1); /* Older versions of webkit */
-moz-filter: grayscale(100%);
-o-filter: grayscale(100%);
-ms-filter: grayscale(100%); /* IE 10 */
filter: gray; /* IE 9 */
filter: url('inc/desaturate.svg#greyscale'); /* Firefox */
opacity: .8;
-webkit-opacity: .8;
-moz-opacity: .8;
/* モノクロ表示のルール エンド*/
/* 時間を置いたもやもやっとした 演出 スタート .3s を .1s等に変えてみて*/
transition: all .3s ease-in-out;
-webkit-transition: all .3s ease-in-out;
-moz-transition: all .3s ease-in-out;
-o-transition: all .3s ease-in-out;
-ms-transition: all .3s ease-in-out;
/* 時間を置いたもやもやっとした 演出 エンド*/
width: 100%;
height: 100%;
z-index: 1;
}
/*
その他 フォント設定
functions.php
add_action( 'init', 'spun_register_fonts' );
*/
上記の変更を行った結果のスナップショット
http://tenman.info/labo/snip/files/spun-child.png
nobitaさん、お忙しいなか回答くださってありがとうございます。
早速試してみたのですが。。。
サークルの色を変える(画像がないタイプ)はできたのですが、画像があるタイプのものを最初から白黒表示することはできませんでした。
色々なパーセンテージでも試してみたのですが、どれもまったく変化がありませんでした。
画像があるタイプは、引き続きトップページをひらいたときには、マウスを持って行くまで全く見えない状態です。
テーマフォーラムでもこれまでの投稿を再度検索し直して、引き続き解決法を探してみます。
テーマフォーラムの投稿を参考に、こちらのコードを使って、解決することができました。
↓
.blog .hentry a .attachment-post-thumbnail {
filter: url(“data:image/svg+xml;utf8,<svg xmlns=\’http://www.w3.org/2000/svg\’><filter id=\’grayscale\’><feColorMatrix type=\’matrix\’ values=\’0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\’/></filter></svg>#grayscale”);
せっかくアドバイス頂いたのに、私の知識不足で応用できずに恐縮です。ごめんなさい。
ありがとうございました。
解決済みのようですが、
firefoxで、この現象が再現できたので、結果を書き込んでおきます。
filter: url('inc/desaturate.svg#greyscale'); /* Firefox */
となっていますが、svgを外部参照しているので、clip-pathを試してみたら、動作するようでした。
clip-path: url('inc/desaturate.svg#greyscale'); /* Firefox */
ra_raさんの、データスキームを使う方法でも、動作が確認できました。
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");
nobitaさん、ありがとうございます!
ちなみにどちらの方法がベター、ということはあるのでしょうか。。。?
どの方法が最良なのかという事は、テストを積み重ねないと結論は出ないだろうと思いますが、
WordPressのテーマの仕組みから考えると、親テーマのspunは、今後もアップデートを続けていくのだろうと思います。
spunには、inc/desaturate.svgという外部ファイルが、常に存在し続ける事になるので、チャイルドテーマは、外部ファイル参照をしておくほうが、自然で後々管理しやすいと思います。
なので、データスキームを使って、直接svgを書いてしまっていると、2重になるので、将来的なメンテナンスの時の混乱が懸念されます。
clip-pathを試した経緯は、
https://developer.mozilla.org/ja/docs/Applying_SVG_effects_to_HTML_content
にあります
また、この問題は、ra_raさんの環境で、特別おきている現象でもなさそうです。
http://wordpress.org/support/topic/problems-on-different-browsers-since-update?replies=11
他、同様の質問が、spun のテーマサポートに寄せられているようです。
個人的には、
1. このフィルタをはずす(firefoxでちょっとちらつきが出るけれども、問題はクリアになる)
filter: url('inc/desaturate.svg#greyscale'); /* Firefox */
2. 今後のspunの動向を見ながら、clip-pathでしのいでおく、
3. サーバー設定に基づく問題という見方もあるようなので、
(spunのでもサイトでは、firefoxで正常に動作している)
.htaccessの設定などを見直すという観点もあるかもしれないです。
(上記のリンクより)
AddType image/svg+xml svg svgz
AddEncoding gzip svgz
大変参考/勉強になりました!詳しいアドバイスありがとうございました!