sticky-kit v1.1.2を使用してテストページに表示されるadsense広告があります。スティッキーのときにスティッキーキットが点滅する
Chromeブラウザを使用しているページを下にスクロールすると、スティッキーキットが固まったときに広告がフラッシュ/リロードされます。
このtrouble shooting guideは、私が経験している正確な問題に対処しているようですが、自分のコードでは機能しません。
マイコードが下に表示されます。彼らは挿入する場所私はわからないですので、私は意図的に(私は私のために多くのシナリオが、どれも仕事をしようとしている)、2次のdivのを残しています。ここ
<div class="sticky-parent">
<div class="sticky-spacer">
</div>
</div>
は私のHTMLコードです:
<div id="id_side_advert_container" class="side_advert col-md-2">
<div class="margin-bottom-20">
<div id="id_side_advert_wrapper">
{# google adsense code to display side advertiements #}
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<!-- zoodal-side-advertisement-responsive -->
<ins class="adsbygoogle"
style="display:block"
data-ad-client="ca-pub-1234567890112987"
data-ad-slot="1234567890"
data-ad-format="auto"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
</div>
は、ここに私JQコードです:
// sticky-kit code for the side advertising sticky - with an offset of 15px when sticky.
$("#id_side_advert_container").stick_in_parent({
offset_top: 15,
parent: ".sticky-parent", // note: we must now manually provide the parent
spacer: ".sticky-spacer",
});
// the following code is the workaround so that the sticky element does not disappear when bottom -
// taken from: https://github.com/leafo/sticky-kit/issues/31 danxshap
$('#id_side_advert_container')
.on('sticky_kit:bottom', function(e) {
$(this).parent().css('position', 'static');
})
.on('sticky_kit:unbottom', function(e) {
$(this).parent().css('position', 'relative');
})
:ソリューションは、スペーサー(
spacer: false
)を使用しないことでした親のCSSに以前に '相対'に設定された 'position'がありませんでした –' 'class =" sticky-parent "' 'を' 'id_side_advert_container''に追加し、divを' 'class = "margin-bottom-20" '' '' class = "margin-bottom-20 sticky-spacer" "となるようにします。 – McLemore
'#id_side_advert_container'のためにCSSに' will-change:margin'を追加してみてください。これは過去の私のパフォーマンスの不具合を修正しました。 –