#掲題
ie11でfilterのボカシは使えないため以下のcssを組み合わせることによって疑似的にボカシを再現しました。
・rgba
・text-shadow
##処理
「main_txt」idの下のh3、pタグをcolor: rgba(255, 255, 255, 0);にして「main_txt」idにjqueryでscrollした際に「main_txt」idにtext-shadowの量を増やしていく事とによってボカシ風にしています。
##問題
ほかのブラウザ(edgeやchrome)では思った通りに動かせる事が出来たのですがieのみcolor: rgba(255, 255, 255, 0);にするとtext-shadow毎消えてしまいます。
またrgbaを外した状態で確認してみても、text-shadowの効きが悪い気がしています(他ブラウザと比べて)
##試したこと
rgba(255, 255, 255, 0);が悪いのかと思いtransparentにしてみましたが結果変わらずにtext-shadowも消えてしまいます。
上手く説明できていないかもしれませんが、回答よろしくお願いします。
html
1 <div class="txt_wrap" id="main_txt"> 2 <h3>test</h3> 3 <p>testtesttesttest<br>testtesttest</p> 4 </div>
css
1 .main .txt_wrap { 2 position: absolute; 3 right: 2.562%; 4 top: 50%; 5 transform: translateY(-50%); 6 color: #fff; 7 z-index: 100; 8 text-align: right; 9 } 10 11 .main .txt_wrap>h3 { 12 font-size: 97px; 13 line-height: 1; 14 margin-bottom: 15px; 15 } 16 17 .main .txt_wrap>h3:first-letter { 18 font-size: 131%; 19 } 20 .main .txt_wrap p { 21 font-size: 16px; 22 line-height: 1.6; 23 } 24 25 .main .txt_wrap.blur>h3 { 26 color: rgba(255, 255, 255, 0); 27 } 28 29 .main .txt_wrap.blur p { 30 color: rgba(255, 255, 255, 0); 31 }
js
1 var $main_txt =$("#main_txt"); 2 $(window).on("scroll",function(){ 3 var sct = $(this).scrollTop(); 4 //console.log("rgb(255, 255, 255) 0px 0px" + sct + "px"); 5 6 if (sct > 25){ 7 //25よりスクロール量が多ければtrue 8 $main_txt.addClass("blur").css({"text-shadow":"rgb(255, 255, 255) 0px 0px " + sct * 0.13 + "px"}); 9 }else{ 10 $main_txt.removeClass("blur").removeAttr('style'); 11 } 12 13 });
回答2件
あなたの回答
tips
プレビュー