关闭按钮,插页式页面广告(Close button with an interstitial out of page ad)

编程入门 行业动态 更新时间:2024-10-17 11:27:50
关闭按钮,插页式页面广告(Close button with an interstitial out of page ad)

我正在尝试在dfp中向页面外广告添加关闭按钮,但我无法让它工作。 我试图按照谷歌提供的说明但没有运气。

这是我的代码

<script> $(document).ready( function() { $(window.parent.document).find('body').css({ "Background-Attachment": "fixed", "Background-Image": "url('[%Image%]')", "Background-Position": "top center", "Background-Repeat": "no-repeat", }); $(window.parent.document).find('body') .after('<a href="%%CLICK_URL_UNESC%%[%ClickthroughURL%]" target="_blank">' + '<img src="%%VIEW_URL_UNESC%%[%Image%]" style="display:block;position:fixed;left:0;top:0;width:100%;height:100%;cursor:pointer" />/a>'); }); </script> <script> function closeHandler() { Enabler.reportManualClose(); Enabler.close(); } </script> <style> #close-btn { position: absolute; width: 20px; height: 18px; top: 0px; left: 278px; cursor: pointer; z-index:220; background-image: url('[%Closebtn%]'); background-repeat: no-repeat; } </style> <div id="close-btn"></div>

谢谢任何帮助将不胜感激

I'm trying to add a close button to an interstitial out of page ad in dfp but I cannot get it to work. I've tried to follow the instructions provided by google but no luck.

This is my code

<script> $(document).ready( function() { $(window.parent.document).find('body').css({ "Background-Attachment": "fixed", "Background-Image": "url('[%Image%]')", "Background-Position": "top center", "Background-Repeat": "no-repeat", }); $(window.parent.document).find('body') .after('<a href="%%CLICK_URL_UNESC%%[%ClickthroughURL%]" target="_blank">' + '<img src="%%VIEW_URL_UNESC%%[%Image%]" style="display:block;position:fixed;left:0;top:0;width:100%;height:100%;cursor:pointer" />/a>'); }); </script> <script> function closeHandler() { Enabler.reportManualClose(); Enabler.close(); } </script> <style> #close-btn { position: absolute; width: 20px; height: 18px; top: 0px; left: 278px; cursor: pointer; z-index:220; background-image: url('[%Closebtn%]'); background-repeat: no-repeat; } </style> <div id="close-btn"></div>

Thanks any help would be appreciated

最满意答案

尝试调用closeHandler()函数;)

function closeHandler() { Enabler.reportManualClose(); Enabler.close(); } closeHandler();

I figured this out so here is the solution. Code changed a bit but I'm achieving the result i wanted.

<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0"> <title>Test 1</title> <style type="text/css"> .center-me { position: absolute; visibility: visible; width: 100%; height: auto; margin: 0; z-index: 10; top: 50px; left: 0; } .center-me img { width: 100%; height: auto; } #close-btn { position: absolute; width: 45px; height: 45px; top: 70px; right: 15px; cursor: pointer; z-index:220; background-image: url('[%CloseBtn%]'); background-repeat: no-repeat; } </style> <script> $(document).ready(function(){ $("#close-btn").click(function(){ $(".ad-wrapper").fadeOut(500); }); }); </script> </head> <body style="margin: 0px;"> <div class="ad-wrapper"> <div id="close-btn"></div> <a href="%%CLICK_URL_UNESC%%[%ClickthroughURL%]"> <div class="center-me"> <img src="%%VIEW_URL_UNESC%%[%ImageFile%]"></img> </div> </a> </div> </body> </html>

更多推荐

本文发布于:2023-04-28 06:14:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1330336.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:插页   按钮   页面   广告   Close

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!