私は自分のウェブサイト(addthis)で共有するソーシャルボタンをいくつか持っており、ボタンのすぐ上にテキストを追加しました。他の要素が存在しない場合や表示されていない場合、要素を非表示にする方法はありますか?
一部の人々はadblockを使用し、ソーシャルボタンを隠す設定をしています。これらの人々はボタンを見ることはできませんが、「Share this!」というテキストが表示されます。
「共有する!」をどうすれば作成できますか?ソーシャルボタンが見えない人はテキストが消えますか?ボタンがユーザーのために存在するかどうかをチェックし、それに基づいて他の要素を表示/非表示する方法はありますか? (表示をチェックする以外:none、それが要素を隠すためにadblockが使用するものでない限りは分かりません)
私は簡単なフィドルを作りました。私はちょうどFacebookのアイコンを表示するために、社会的なプラグインからコードの一部を引っ張った。
https://jsfiddle.net/bsuup9vf/6/
<div class="addthis_responsive_sharing"> <!-- This line initiates the plugin to generate the rest of the code -->
<div id="share-this"> <!-- I want to hide this div only if the plugin is blocked or if it's elements aren't visible on the screen for some other reason -->
<div class="share-text">Share this!</div>
<span class="share-arrow right-arrow" style="font-size:24px;">⤹</span>
</div>
<!-- This is the parent div for the actual social buttons-->
<div id="atrsb" class="at-resp-share-element addthis_32x32_style at-mobile addthis-smartlayers addthis-animated at4-show">
<!-- Facebook - I pulled this from the live code just to display the FB icon -->
<span class="at-icon-wrapper" style="background-color: rgb(59, 89, 152);">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 32 32" title="Facebook" alt="Facebook" class="at-icon at-icon-facebook" style="fill: rgb(255, 255, 255);">
<g>
<path d="M22 5.16c-.406-.054-1.806-.16-3.43-.16-3.4 0-5.733 1.825-5.733 5.17v2.882H9v3.913h3.837V27h4.604V16.965h3.823l.587-3.913h-4.41v-2.5c0-1.123.347-1.903 2.198-1.903H22V5.16z" fill-rule="evenodd">
</path>
</g>
</svg>
</span> <!-- /.Facebook -->
</div> <!-- /.atrsb -->
</div> <!-- /.addthis_responsive_sharing>
申し訳ありませんが、このような同様の質問が以前に頼まれている場合。
皆様、ありがとうございました!
可能な重複に設定されていないかどうかを確認することができます[どのように検出するために、私のウェブサイトのAdblock?](http://stackoverflow.com/questions/4869154/how-to-detect-adblock-on-my-website) –
あなたはどのようにアドブロックがアイコンを隠すかチェックしましたか?それは単にそれをロードしないか、それをロードして隠すか(display:none)? –
何か試しましたか?あなたの仕事はどこですか?コピーアンドペーストの回答をお探しですか? – hungerstar