私は、製品に関するいくつかの情報を読むことができるように、リンクをクリックするとオーバーレイが画像の上に来るようにするプロジェクトがあります。移行がrgbaで正常に動作しない
:私はそうのように、情報を持つdiv要素や絵を持っているdivの内側の白い背景を持ってこれを行うためには:私は探しています効果は、このようなものです
<div id="leftWindow">
<a href="notalink.html" id="infoButton">+ Information</a>
<div id="info" class="notVisible">
Some information about this product Some information about this product Some information about this product Some information about this product Some information about this product Some information about this product Some information about this product Some information about this product
</div>
</div>
情報を持つdiv要素は「notVisible」のクラスを持っていると私はそうのように、0.7の不透明度を持つ別のクラスを持っている:
#info {
background-color: white;
transition: opacity 1.5s ease-in-out;
position: absolute;
top: 0;
left: 0;
width: 342px;
height: 516px;
padding-left: 20px;
padding-right: 20px;
padding-top: 10px;
}
.visibleIsh {
opacity: .7;
}
ときもしCリンク上なめる、いくつかのJavaScriptクラスを入れ替え:
$(document).on('click', '#infoButton', function(e){
e.preventDefault();
$("#info").removeClass("notVisible").addClass("visibleIsh");
});
これは動作しますが、問題は、テキストがまた、私はしたくない不透明度を失っていることです。
CSS:これを解決するために、私はそうのように、RGBAの代わりに、不透明度を使用し
.visibleIsh {
background-color: rgba(255,255,255,.7);
}
#info {
background-color: rgba(255,255,255,1);
transition: background-color 1.5s ease-in-out;
position: absolute;
top: 0;
left: 0;
width: 342px;
height: 516px;
padding-left: 20px;
padding-right: 20px;
padding-top: 10px;
}
そして、私はあなたがGIFで見ることができるバグの動作を取得します。どんな助けもありがたい。ありがとう
私は第二のgifには何もバギーが表示されません。問題を説明してください。 – Saurabh
スムーズなトランジションがなく、アルファベットに.7が適用されていません – Paul
正しく覚えていれば、テキストに直接フェードトランジションを適用することはできません。トランジションは行われませんが、トランジションがタイムアウトするとすぐにすべて消えます。代わりにテキストを保持しているコンテナをフェードアウトする必要があります。 – Korgrue