On Jan 19, 11:56 pm, Aaron Boodman <a...@google.com> wrote:
> You have to either hardcode the full absolute URL create that part of
> the CSS dynamically with javascript.

Thanks! Had a feeling that was going to be the deal. So, here's what I
did (for anyone that wants an example):

I left the CSS as a separate file and removed the background image
definition from it:

  ...
  div#MailPop div.close {
          position:absolute;
          top:2px;
          right:5px;
          width:35px;
          height:35px;
          cursor:pointer;
  }
  ...

In the Javascript I create the chrome-extension:// URL for the image:

  ...
  var closeButtonURL = chrome.extension.getURL('images/overlay/
close.png');
  ...

The div's that I'm trying to apply this to begin as JavaScript strings
and are injected from the Javascript, so I add the background image in
there using the 'style' attribute:

  ...
  var overlayDiv = '\
  <!-- overlays --> \
  <div class="MailPopOverlay" id="MailPop" style="background-image:url
('+bgImgURL+');"> \
    <div class="close" style="background:url('+closeButtonURL+')"></
div> \
  ...

Then just inject it into the body:

  ...
  $('body').prepend(overlayDiv);
  ...

That did the trick!

Cheers,

George

-- 
You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to chromium-extensi...@googlegroups.com.
To unsubscribe from this group, send email to 
chromium-extensions+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en.


Reply via email to