0

我对 data-block-on-consent 属性有一些问题,而且一旦用户反对广告和跟踪活动,每个受影响元素的高度仍然存在,并显示由高度属性定义的空白空间元素。

<amp-ad .... height=100..> 

问题是:在没有用户同意的情况下如何摆脱这个空白空间?

4

1 回答 1

2

假设有一个按钮或某个元素被点击以关闭同意/广告,则 amp-bind 应该能够处理将高度更改为零,因为高度是可绑定的属性。像这样的东西应该可以工作,改变你点击元素的按钮。

<amp-ad height="250" 
       [height]="adHeight[currentHeight]"
       ...>
</amp-ad>
<amp-state id="adHeight">
<script type="application/json">
{
  "noHeight": 0,
  "fullHeight": 250
}
</script>
</amp-state>

<button on="tap:AMP.setState({currentHeight: 'noHeight'})">Hide Ad</button>
于 2018-05-08T15:38:07.593 回答