W
W
Waksim2017-09-17 19:33:09
css
Waksim, 2017-09-17 19:33:09

Why Adsense ads don't work under spoiler?

Hello, there is a simple spoiler on the site:
https://jsfiddle.net/Waksim/oax00uuj/1/?utm_source...
HTML

<div class="spo disabled">
  <div class="spoh">Заголовок</div>
  <div class="spob">Здесь текст и код Google AdSense</div>
</div>

css
/*Спойлер*/
.spo{background:#fff;margin: 0 0 8px;border:1px solid #efefef}
.spoh{background:#efefef;cursor:pointer;padding:5px;}
.spob{padding:10px}
.spo.disabled .spob{display:none}
.spo.active{border-color:#57AA43}
.spo.active .spoh{background:#57AA43;color:#fff}

jQuery
<script>
jQuery(document).ready(function(){
  jQuery('.spoh').click(function(){
    $(this).parent().toggleClass("active").children('div.spob').toggle('normal');
  })
})
</script>

The problem is that no matter how I try to put ads under the spoiler, the output is empty space (example - picture below)
6235fecb4f4d4451bb6f827ccb46b0b7.png
Can anyone come across, please tell me how to solve the problem !!!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexander, 2017-09-17
@NeiroNx

When the code is loaded - the element is hidden, the code cannot show ads if the element is hidden. Advertising must be added at the time the element is expanded.

S
Sergey, 2017-09-17
@VSeryoga

There may be no ads for this page, happened on new test pages or on new types of ads

E
Eugene, 2017-09-18
@Eugeny1987

Make spoilers open and collapse them after the page has loaded

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question