Observerをつかて、要素を監視して
gdpがshowになったら何かするサンプルっぽい
<script>
// observeForTargetElement = document.getElementById("div-gpt-ad-1733-0");
// // intersection
// let intersection = new IntersectionObserver(function(entry) {
// console.log(entry[0].intersectionRatio)
//
// //googletag.cmd.push(function() {
// // googletag.display('div-gpt-ad-1733-0');
// //})
//
// //監視の停止(実際には特定条件下で実行)
// let shouldStopObserving = false;
// if (shouldStopObserving) {
// intersection.disconnect();
// }
//
// }, {root: null, rootMargin: "0px", threshold: buildThresholdList()});
// intersection.observe(observeForTargetElement);
//
//
// function buildThresholdList() {
// let thresholds = [];
// for (let i = 1.0; i <= 10; i++) {
// thresholds.push(i / 10);
// }
// thresholds.push(0);
// return thresholds;
// }
</script>
More than 3 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme
List of users who liked
00