実現したいこと
SVG画像で出来たテキストの色ををmix-blend-modeで変更させたいです。
発生している問題・分からないこと
jquery.arctext.jsを使ってテキストをアーチ状にして、そこから色の変更も試みたのですがうまくいきませんでした。
SVGとjquery.arctext.jsだと、どちらがいいのでしょうか?
それか他の方法があればお教えください。
該当のソースコード
PHP
1<div class="fixed-icon" id="js-scroll-icon"> 2 <div class="fixed-icon__text-pc"> 3 4<svg id="_レイヤー_1" class="svg-arch-text" data-name="レイヤー 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 284.68 72.69"> 5 <defs> 6 <style> 7 .svg-arch-text path { fill: #ffffff !important; } 8 .svg-arch-text .cls-1 { fill: #ffffff !important; } 9 </style> 10 </defs> 11 <path d="M20.08,64L0,51.7l.41-.66,20.08,12.3-.41.66Z"/> 12 <path d="M20.95,38.21c. 13 14~中略~ 15 16<path d="M284.47,65.76l.21.75-22.59,6.18-.21-.75,22.59-6.18Z"/> 17</svg> 18 </div> 19 20 <a href="#" class="fixed-icon__text-sp fixed-icon__text">まずは<span class="u-red">1日</span>体験してみませんか?</a> 21 22 <a href="#" class="fixed-icon__link"> 23 <h3 class="fixed-icon__title">お試し<br>入社</h3> 24 <span class="fixed-icon__sub">申込はこちら</span> 25 </a> 26</div>
CSS
1.fixed-icon { 2 position: fixed; 3 bottom: 0; 4 left: 0; 5 width: 100%; 6 z-index: 9999; 7 text-align: center; 8 overflow: visible !important; 9 pointer-events: none; 10 visibility: hidden; 11 transition: visibility 0.6s; 12 isolation: auto !important; 13} 14.fixed-icon.is-show { 15 visibility: visible; 16} 17.fixed-icon__link { 18 display: flex; 19 justify-content: center; 20 align-items: center; 21 gap: 20px; 22 padding: 3px 0 10px; 23 background-color: #F9A825; 24 text-decoration: none; 25 opacity: 0; 26 transform: translateY(20px); 27 transition: opacity 0.6s, transform 0.6s; 28} 29 30.fixed-icon.is-show .fixed-icon__link { 31 opacity: 1; 32 transform: translateY(0); 33 pointer-events: auto; 34} 35.fixed-icon__title { 36 color: var(--ark-title-main); 37 line-height: 1.1; 38 font-weight: 700; 39 margin: 0; 40} 41.fixed-icon__title br { display: none; } 42.fixed-icon__sub { 43 background-color: var(--ark-title-main); 44 color: #fff !important; 45 font-size: 14px; 46 padding: 4px 12px; 47 border-radius: 20px; 48} 49.fixed-icon__text-sp { 50 width: 100%; 51 display: flex; 52 justify-content: center; 53 align-items: baseline; 54 padding-top: 10px; 55 background-color: #F9A825; 56 font-weight: 500; 57 font-size: 16px; 58 font-family: "Inter", sans-serif; 59 color: #333; 60} 61.fixed-icon__text-sp .u-red { 62 color: #e22727; 63 font-size: 18px; 64} 65.fixed-icon__text-pc { 66 display: none; 67} 68.svg-arch-text { 69 width: 100%; 70 height: auto; 71 display: block; 72 overflow: visible; 73} 74.svg-arch-text path { 75 fill: #ffffff !important; 76} 77@media screen and (min-width: 1200px) { 78 .fixed-icon { 79 width: 180px; 80 height: 180px; 81 left: auto; 82 right: 50px; 83 bottom: 20px; 84 } 85 .fixed-icon__text-sp { display: none; } 86 .fixed-icon__text-pc { 87 display: block; 88 position: absolute; 89 top: -30px; 90 left: 50%; 91 width: 280px; 92 z-index: 20; 93 pointer-events: none; 94 mix-blend-mode: difference !important; 95 96 /* アニメーション */ 97 opacity: 0; 98 transform: translateX(-50%) translateY(20px); 99 transition: opacity 0.6s, transform 0.6s; 100 } 101 .fixed-icon.is-show .fixed-icon__text-pc { 102 opacity: 1; 103 transform: translateX(-50%) translateY(0); 104 } 105 .fixed-icon__link { 106 width: 180px; 107 height: 180px; 108 border-radius: 50%; 109 flex-direction: column; 110 gap: 5px; 111 box-shadow: 0 4px 15px rgba(0,0,0,0.2); 112 } 113 .fixed-icon__title { font-size: 35px; } 114 .fixed-icon__title br { display: block; } 115}
JavaScript
1jQuery(function($) { 2 var $icon = $('#js-scroll-icon'); 3 $(window).on('scroll', function() { 4 if ($(this).scrollTop() > 200) { 5 $icon.addClass('is-show'); 6 } else { 7 $icon.removeClass('is-show'); 8 } 9 }); 10});
試したこと・調べたこと
- teratailやGoogle等で検索した
- ソースコードを自分なりに変更した
- 知人に聞いた
- その他
上記の詳細・結果
色々と試してみましたが、上手くいきませんでした。
補足
特になし
