SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    USA
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Floating Google Ads...

    [Note: This MAY be a CSS issue. I just don't know.]
    Visual Aid: http://www.sportsmaniax.com/adsense.php

    Ok, here's the question: How do i modify the code in (http://www.sportsmaniax.com/adsense.js) to align the floating box to the bottom of the screen (instead of the right side)? I've tried changing the style to "bottom:0px;" instead of "right:0px;" - that doesn't work. My guess is that it's in the javascript code.

    Any thoughts?

  2. #2
    SitePoint Zealot skyhawk133's Avatar
    Join Date
    Sep 2005
    Posts
    102
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This seems like it would violate the AdSense TOS... you might want to check if Google will allow this.

    Sitepoint has a tutorial on how to "float" ads at the bottom of the screen... you can find their code here:

    http://www.sitepoint.com/blogs/2005/...atfish-part-1/

    There is another version available that doesn't work as well in IE, but still gets the job done:

    http://code.dreamincode.net/snippet370.htm

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    USA
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    You may be right...

    I haven't checked the TOS yet. If it does it's not really a problem, I can serve ads from another source (or sell books ). I'm just hoping to get it positioned where i want it first.

    Thanks for the tips!

  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    USA
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cool Ok...

    Turns out it IS against the Google TOS. So, I may have to serve ads from elsewhere.

    Just decided to come back and post that for anyone that might read this thread.

  5. #5
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,869
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    If you put the entire adsense Javascript code into a <div> then you can position that div where-ever you like on your page without having to touch the Google supplied code (and since you don't touch their code you don't breach their TOS). The only thing you cant do by applying stylesheets to the div is to get anything else to display over the ad in Opera since the ad uses an iframe and iframes are always in front in Opera.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  6. #6
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    USA
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    That's what i did...

    I think I've removed the code now but I just placed the Google ads in a separate div and used JS to position it on the page.

    I wrote to them and they said it was against the terms of service.
    Thanks for your inquiry. Yes, this implementation of AdSense ad code does violate our program policies, regardless of where on the page the ad is located.

    Publishers are not permitted to alter the behavior of Google ads. This includes implementing the AdSense ad code in a "floating box script."
    Anyway... maybe i can use Yahoo! or Adbrite or someone.

  7. #7
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,869
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Your problem was that you put it in a floating box (presumably over some of the page content). As long as the code is actually in the same layer as the rest of the page there is no problem with how you position it after all Google even provide info on their site to help you work out the best pacement for their ads on web pages.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  8. #8
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    USA
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Right.

    But the goal was to have the ads 'follow' the user down a long page and so that's why i did it like that.

    The original question was how to move the box to the bottom of the screen and 'float' down as the user scrolled down. If anyone has an answer to that I would still like to know.

  9. #9
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,869
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    Having the ad move is what would have made it breach Google's TOS.

    If your page is long enough to need to have ads moving like that then the page is probably too long. Why not split it into separate linked pages and then you get more ads to display. From stats I have seen, a lot of people don't bother scrolling a web page at all.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  10. #10
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    USA
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    So....

    Do you know how to do it? (Make it float at the bottom?)

  11. #11
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,869
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    The stylesheet command position:fixed is supposed to fix things in a set position in the browser window so they don't scroll. Unfortunately some version 5 and 6 browsers that are still in use by a significant number of web users don't support this properly. For a Javascript solution see the first few tutorials at http://javascript.about.com/od/animationtutorials/
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  12. #12
    SitePoint Enthusiast
    Join Date
    Aug 2003
    Location
    USA
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Ok...

    Thanks. I'll look at that...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •