Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8046779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:54:05+00:00 2026-06-05T05:54:05+00:00

Say I have something like this: <a href=/ad.php?go=123> <div class=ad></div> </a> Lets say the

  • 0

Say I have something like this:

<a href="/ad.php?go=123">
    <div class="ad"></div>
</a>

Lets say the <div> has height of 50, width of 250, and a background of some generic banner.

What I want to do is not to replace it (which implies erasing the original) but rather create an (what I envision to be) absolutely positioned copy except with a background of white and a higher z-index, rendering the ad invisible.

Think of this as something adblock does, except without toggling off the actual ad, but rather overlaying it with white.

What’s the best way to go about something like this?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:54:09+00:00Added an answer on June 5, 2026 at 5:54 am

    Just select the anchor and set visibility:hidden. The element will remain, the layout will stay the same, but the ad won’t be visible.

    $('a').css('visibility', 'hidden'); // replace 'a' with the appropriate selector for your ads, of course
    

    Doing it the hard way

    Get the dimensions of the selected element using .width() and .height(). Create a new element and set the height, width, and zindex using .css(). The part that sucks is positioning it. Usually, you can get away with just using .offset() to get the top and left. Sometimes it’s trickier. I’d recommend the jQuery UI positioning plugin. Furthermore, the positioning will be off when the browser window is resized. You’ll need to handle $(window).resize() and reposition all your overlays. It’ll flicker, it’ll look like crap… which is why you should just use visibility:hidden. But, suit yourself.

    But at a minimum:

    var $a = $('.ad');
    
    
    $a.each(function() {
        var $this = $(this);
        $this.before($('<div></div>')
             .addClass('ad-overlay')
             .css({
                height: $this.height(),
                width: $this.width(),
                'z-index': 1000,
                'background-color': 'white',
                position: 'absolute',
                top: $this.offset().top,
                left: $this.offset().left
            }));
    });
    

    Here’s a fiddle. http://jsfiddle.net/HackedByChinese/SF4tw/4/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

lets say I have something like this: class Program { static void Main(string[] args)
Here is the Problem: Lets say I have something like this: <div id=leftcontainer> <div
Lets say i have something like this: This is file tree.py: class leaf(): def
Let's say I have something like this: <?php namespace Twitter; class Twitter { function
Let's say I have something like this: abstract class Parent { protected function foobar($data)
Lets say I have something like this: http://gyazo.com/642987562175afc6d11a962762327744.png?1329570534 Basically, the user fills out this
let's say we have something like this public class Person { public string Name
Say I have something like this <script type=text/javascript src=somefile.js></script> <div>something</div> <script type=text/javascript> // Some
Lets say I have something like this: private CancellationTokenSource myToken; public void MyMyMethod() {
Lets say I have something like this uid tag 1 HeLLo 2 heLLO 3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.