views:

44

answers:

1

I'm developing a product to be used by a number of customers alongside our Web application.

Quick background:

  • These customers have incorporated into their pages a widget that we've developed.
  • The widget's content can be modified by using our application.
  • The idea behind this product is a bookmarklet that we supply, which will "highlight" our widget on their page, turning it into a clickable link that leads to an administration panel in our app.

The "highlight" effect actually involves some z-index tricks; we create a semi-transparent "backdrop" <div> just a few ticks below the maximum-supported z-index to gray out the page; then, we adjust the z-index of our widget to sit on top of that translucent backdrop. The visual effect should look about like this:

http://skitch.com/troywarr/dtexp/example-good

However, in Safari, as well as Firefox under certain conditions, there seem to be some sort of rendering artifacts that prevent this from looking as intended:

http://skitch.com/troywarr/dteqx/example-bad

As you can tell from the screenshot, a couple of elements (our logo image and the <iframe> that holds an advertisement) are still "bright," as intended. But, the rest of the widget is still shaded-out.

I've been poking around with Firebug for quite a while to try to get at the source of the problem, but I haven't had any revelations. I'm hoping that someone has experienced a similar issue, or recognizes the "visual signature" of this kind of problem. Or, if you're simply adept at JavaScript/jQuery and/or Firebug, I could really use your help trying to figure out where this approach is falling short.

I created a test bookmarklet as a live example. To see it, please:

Thanks very much in advance for any help! This has me baffled.

+1  A: 

I was about to give up on this, but I think I found the problem. You have a hell of a lot of DOM elements going on here, but luckily that isn't the issue causing this problem.

The iframe inside DIV#onespot_nextclick needs a background color of #FFF.

Simple!

Bryan Downing
Bryan, you are **awesome**! That solves it. I guess the fact that the `<body>` element of the widget in the `<iframe>` didn't have an explicit color set meant that it had defaulted to transparent, which, when moved up in the z-index order, caused the backdrop `<div>` to "shine through." Anyway, thanks **so** much for your help - I really appreciate it.
Bungle
No problem! From your question I was certain I would be able to figure it out, but then it ended up being quite difficult. It was a fun challenge. Of course it ended up being something ridiculously simple (as per usual). Now just wait until it gets implemented on a site that doesn't have a white background. You may want to make it dynamic. Also think about custom patterned backgrounds. Good luck!
Bryan Downing