Div with Hide and iframe inside, but link does not open

Asked

Viewed 378 times

-1

Upon entering the website, You can see that there will be a div following the mouse, and its content is an iframe. When clicking on this div or the iframe image, they disappear, however, the main objective is to click on the link from within the iframe, but clicking does not enter the link, IE Hide is working, but the link does not work. I don’t know if I expressed myself well, so feel free to correct my words.

The script used to hide the div is here.

The "follow the mouse" script I’m using is the following code:

HTML:

<div id="position">
  <iframe style="border:none;  width:680px; height:250px;" frameborder="0" scrolling="No" src="http://saudeonline.info/anuncio/index.html"> </iframe>
</div>

CSS:

#position {
  position: absolute;
  z-index: 999999;
}

Javascript:

if (document.all) {} else document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = mouse;

function mouse(e) {
  if (navigator.appName == 'Netscape') {
    xcurs = e.pageX;
    ycurs = e.pageY;
  } else {
    xcurs = event.clientX;
    ycurs = event.clientY;
  }
  document.getElementById('position').style.left = (xcurs - 530) + 'px';
  document.getElementById('position').style.top = (ycurs - 60) + 'px';
}

Upon entering the website, will appear the logo banner of Argoconstructor and the link of the image in the status bar, but when clicking, does not go to the site, the div closes.

  • Is there a problem if the click is done via js? Why then you only add a very simple snippet in your code: $("#position"). on("click",Function() { window.open("http://www.microsoft.com"); });

1 answer

0

I believe the problem is your iframe code. If you click on a link inside an iframe the default behavior and open the new window inside the iframe itself (which you just hid). To solve this you can try to put a target="_blank" on the link which instructs the browser to open the link on a new page. would look like this:

<a target="_blank" href="http://www.argoconstrutora.com.br/"><img src="img/anuncie.jpg" width="680" height="250" alt=""></a>

Having said that, this behavior of forcing the user to click on an ad and force the appearance of a new window is considered bad and will probably serve only to keep visitors away from your site.

  • I figured it would solve, but I wouldn’t want to use target="_Blank" Is there any other way?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.