网站背景广告

发布于 2024-08-04 21:24:42 字数 529 浏览 2 评论 0原文

我目前正在制作一个网站,所有者想要背景广告(整个网站上作为背景的广告)。

用 css 制作很容易:

body
{
   background-image: url('ad.jpg');
   repeat, color.....
}

但是,他们希望它是一个链接。这有点困难,所以我需要一些帮助。

我尝试过这样的事情:

<a runat="server" href="http://adlink" id="BackgroundAdLink" style="position: fixed; display: block; left: 0; top: 0; z-index: -1; min-height: 100%; min-width: 100%;">
    &nbsp;
</a>

但它不能正常工作。我希望该解决方案能够在 IE/FF/Safari 等中工作。我在网站上使用 jQuery,所以我对此有所了解。

此致, 拉塞

I'm currently making a website where the owners want background ads (a ad as background on the whole site).

It is quite easy to make in css:

body
{
   background-image: url('ad.jpg');
   repeat, color.....
}

But, they want it to be a link. It is a little bit harder so I need some help with that.

I have tried with something like this:

<a runat="server" href="http://adlink" id="BackgroundAdLink" style="position: fixed; display: block; left: 0; top: 0; z-index: -1; min-height: 100%; min-width: 100%;">
     
</a>

But it does not work properly. I want the solution to work in IE/FF/Safari etc. I use jQuery on the site, so I know a littlebit about it.

Best regards,
Lasse

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

反目相谮 2024-08-11 21:24:42

非后台内容的预期点击行为是什么?它是否可以独立于背景广告进行点击?

如果这是要求,我会在 body 标签后面设计一个根 div 层。也许给它一个可以定位的“adsitelayer”ID。使其成为主容器 div。将尺寸设置为 100%,然后使用 jQuery 或其他方法使其可点击,然后在此基础上构建设计。

不要把这个放进身体里。通过这种方式,您可以将其设置为插页式 div 层,可以轻松地从不需要广告的页面上的设计中提取该层。

顺便说一句,这是一个奇怪的要求。那么基本上,如果我点击页面上的其他任何地方,我就会看到广告?如果客户有要求,请执行此操作。但您应该告诉他们,从可用性的角度来看,这确实是一种奇怪的行为,并且可能会关闭该网站的用户。只是我的两分钱。

垃圾邮件之所以成为垃圾邮件,不是因为它的广告内容,而是因为它的广告方式。从 SEO 的角度来看,这种行为可能会引起人们的注意。我不确定谷歌会喜欢这个。他们甚至可能将该网站视为恶意软件,具体取决于他们的政策。

What is the expected click behavior of content not in the background? Will it be clickable independent of the background ad?

If this is the requirement I would design in a root div layer just after the body tag. Perhaps give it an id of "adsitelayer" that can be targeted. Make this the main container div. Set the dimensions to 100% and then make this clickable using jQuery, or what not, and then build the design on top of that.

Don't put this in the body. This way you can make it an interstitial div layer that can easily be extracted from your design on pages that don't need the advert.

By the way this is kind of an odd requirement. So basically if I click anywhere else on the page I am going to go to an advertisement? Implement this if the client demands it. But you should inform them that this is really bizarre behavior from a usability perspective and will likely turn off users of the website. Just my two cents.

Spam is spam not because of what it advertises, but the way it advertises. This behavior might raise eyebrows from an SEO point a view. I am not sure google will like this. They might even treat the site as malware, depending on their policy.

森林迷了鹿 2024-08-11 21:24:42
$('body').click(function(event){
    window.location = "http://adsite.com";
});

不确定这是否有效,但我不知道有任何其他方法可以使整个页面的背景可点击。

$('body').click(function(event){
    window.location = "http://adsite.com";
});

Not sure that would work, but I don't know of any other way to make the background of an entire page clickable.

烂人 2024-08-11 21:24:42

我使用这种方法取得了一些成功:

<body>
<script type="text/javascript">
        $(document).ready(function() {
            $('body').css('cursor', 'pointer');

            $('body').click(function(event) {
                if (event.target == event.currentTarget)
                    window.open('http://www.google.dk');
            });

            $('div#Center').hover(function() {
                $('body').css('cursor', 'auto');
            }, function() {
                $('body').css('cursor', 'pointer');
            });
        });
    </script>
<div id="Center">
My content...
</div>
</body>

我知道它没有广告层,但只能在 IE 中正常工作。鼠标无法点击页面顶部。

这段代码也不是完美无缺的。如果向下滚动页面,则无法单击。也许身体标签的东西不向下扩展。我将身体设置为高度:100%;最小高度:100%;但它不起作用。有什么建议吗?

I have some success using this method:

<body>
<script type="text/javascript">
        $(document).ready(function() {
            $('body').css('cursor', 'pointer');

            $('body').click(function(event) {
                if (event.target == event.currentTarget)
                    window.open('http://www.google.dk');
            });

            $('div#Center').hover(function() {
                $('body').css('cursor', 'auto');
            }, function() {
                $('body').css('cursor', 'pointer');
            });
        });
    </script>
<div id="Center">
My content...
</div>
</body>

I know it does not have a ad layer, but that did only work properly in IE. The mouse could not click on the top of the page.

This code is not flawless either. You can't click if you scroll down a page. Maybe something with the body tag not expanding downwards. I have body set to height: 100%; and min-height: 100%; but it did not work. Any suggestions?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文