开发者

Click through transparent floating iframe

I have a transparent floating iFrame with a lot of empty area. It floats on top of my site (position:fixed).

The problem is that if anyone click on the empty area, it does not click bel开发者_JAVA百科ow on the real page.

Is there a way to perform this? Like a click through in someway.


Well, no. The only thing you could do is to simulate it by capturing the click event, get the coordinates, and then try to find the correct element beneath, and execute the onclick event handler. However, it's a bit impractical, and I think that you should expect some bugs..

Are you sure there isn't another way to solve your problem without that transparent iframe?


Traversing DOM would be necessary, as stated by Onkelborg.

You'd get the mouse position and test every dom element to see whether or not it was clicked. You'd then have to invoke whatever event handler you've defined... You'd have to manually manage event bubbling as well [which is different between IE and other browsers, as far as i know]...

I should also note that it isn't possible to take a picture of your website with JavaScript, so you couldn't click through transparent text either way, nor could you click through images that have transparency.

I think the best option here would be for you to show us an example of what you're trying to do. Usually, a little restructuring of the website can go around this problem.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜