Background advertising on the site

I am currently creating a site where the owners want to receive background ads (ad as background throughout the site).

It's easy to do this in css:

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

      

But they want it to be a link. This is a little more complicated, so I need help.

I've tried 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%;">
    &nbsp;
</a>

      

But it doesn't work right. I want the solution to work in IE / FF / Safari, etc. I am using jQuery on the site, so I know a little about it.

Regards, Lasse

+2


source to share


3 answers


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 doesn't have an ad layer, but it only works in IE. The mouse could not click on the top of the page.

This code is also not flawless. You cannot click if you scroll down the page. Perhaps something with the body of the body not expanding downward. My body is tuned: 100%; and min-height: 100%; but it didn't work. Any suggestions?

+1


source


What is the expected behavior of clicks on content not in the background? Will it be clickable independently of the background ad?

If this is a requirement I would like to create in the root div layer just after the body tag. It might be an "adsitelayer" identifier that could be targeted. Make it your main container div. Set the dimensions to 100%, then do it with jQuery, or whatever, and then build on top of that.

Don't put it into the body. This way you can make it an interstitial div that can be easily pulled from your design on pages that don't need a declaration.



By the way, this is an odd requirement. So basically, if I click anywhere else on the page, I'm going to go to the advertisement? Implement this if the client requires it. But you have to inform them that this is indeed strange behavior in terms of usability and will probably disable website users. Just my two cents.

Spam is spam not because of what it advertises, but how it advertises. This behavior can raise eyebrows in terms of SEO. I'm not sure if Google will like it. They may even consider the site as malware, depending on their policies.

+2


source


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

      

Not sure if this will work, but I don't know of any other way to make the background image of the whole page available.

+1


source







All Articles