本来 CSS3 で簡単にできるところを、IE だけみっともないので、何とか頑張ってみました。 、が、実際問題こんな事している時代でも無いのですが・・・ 現実にはまだ問題があるのが、IE で見てもらうと良く解りますが、現状の再確認と言うことです。
<style type="text/css">
.box_transition {
-webkit-transition: all 1.3s ease-out;
-moz-transition: all 1.3s ease-out;
-o-transition: all 1.3s ease-out;
transition: all 1.3s ease-out;
filter:progid:DXImageTransform.Microsoft.Fade(duration=2);
}
.set_image {
width: 526px;
height: 640px;
background: no-repeat url(https://lh4.googleusercontent.com/-Hy0zxyLJ1l8/T-H1qhd4AxI/AAAAAAAAG30/KGtB2FknDAE/s640/H_2016a.png);
}
</style>
<script type="text/javascript">
(function() {
if(window.navigator.userAgent.toLowerCase().indexOf("msie") == -1) {
str="";
str+="<style type=\"text/css\"> \n";
str+=".set_image:hover { \n";
str+=" background-color: #000; \n";
str+="} \n";
str+="</style> \n";
document.write(str);
}
})();
</script>
<div class="box_transition set_image"
onmouseover='try{this.filters[0].Apply();this.style.backgroundColor="#000";this.filters[0].Play();}catch(e){}'
onmouseout='try{this.filters[0].Apply();this.style.backgroundColor="#fff";this.filters[0].Play();}catch(e){}'
></div>
えっと、IE のアンチエイリアスのバグに対応しました。 ( あまり意味無いとは思いますが )
<style type="text/css">
.box_transition {
-webkit-transition: all 1.3s ease-out;
-moz-transition: all 1.3s ease-out;
-o-transition: all 1.3s ease-out;
transition: all 1.3s ease-out;
filter:progid:DXImageTransform.Microsoft.Fade(duration=0);
}
.set_image {
width: 526px;
height: 640px;
background: no-repeat url(https://lh4.googleusercontent.com/-Hy0zxyLJ1l8/T-H1qhd4AxI/AAAAAAAAG30/KGtB2FknDAE/s640/H_2016a.png);
}
</style>
<script type="text/javascript">
</script>
<div id="target" class="box_transition set_image"
onmouseover='try{this.filters[0].Apply();this.style.backgroundColor="#000";this.filters[0].Play();}catch(e){}'
onmouseout='try{this.filters[0].Apply();this.style.backgroundColor="#fff";this.filters[0].Play();}catch(e){}'
></div>
<script type="text/javascript">
(function() {
if(window.navigator.userAgent.toLowerCase().indexOf("msie") == -1) {
str="";
str+="<style type=\"text/css\"> \n";
str+=".set_image:hover { \n";
str+=" background-color: #000; \n";
str+="} \n";
str+="</style> \n";
document.write(str);
}
else {
target.filters[0].Apply();
target.style.backgroundColor="#fff";
target.filters[0].Play();
target.filters[0].duration = 2;
}
})();
</script>
関連する記事 CSS3 + JavaScript(IEはFilter) : 「フェードイン、フェードアウト」制御
|
|
【CSS3の最新記事】
- CSS/jQuery : 『display:table-cell』 と 『margin:auto』 と 『vertical-align:middle』 を使用して、吹き出し画像の中央に文章を表示する
- CSS の box-shadow を jQuery を使ってスライダーでどうなるか確認して定義文字列を取得できるようにしました
- CSS アニメーションによるハンバーガーアイコンの作成方法と CSS プロパティの意味
- CSS だけで回る、実行中アイコン ( 但し IE9 は不可 ) の指定されたCSSの意味の解説
- 『3D Bouncing Ball with CSS3』のデータを使って光沢ボタンを作成する
- フリーフォントを使った背景透過PNGとCSSを使って、グラデーションな影付き吹き出しやボタンを作る。
- Google ストリートビューを表示している class="gm-style"
- linear-gradient のみで、ほぼ大丈夫なようです(IEは10限定、Windows Safariはアウト)
- 現時点の IE9、IE10、Chrome、Firefox、Opera、Safari でグラデーションの CSS 記述
- CSS3 : box-shadow の影分身の解説
- CSS で画像が立ってるような影を付けて、画像の角は丸くしておく
- CSS3 と HTML5 で実装具合の表示テスト - 2 / ( 透過・倍率編 )
- CSS3 と HTML5 で実装具合の表示テスト
- ブラウザ別の角丸とグラデーションの適用状態の比較画像
- CSS3 の borderRadius で、四角から円へのモーフィング
- CSS3 : 絶対位置指定(absolute)を使用して簡単にアニメーション。しかも、適用するのは、JavaScript






