views:

627

answers:

2

I want to use a lightbox like Shadowbox or similar inside a Firefox extension. But Shadowbox causes Javascript errors like this:

Error: document.write is not a function
Source file: chrome://iframe/content/shadowbox/shadowbox.js
Line: 1557

Which lightbox supports IFRAMEs and will run correctly inside an extension (ie. added to the overlay XUL)?

A: 

Quite possibly none. Lightboxes are meant to work with (X)HTML, not XUL.

Can Berk Güder
+1  A: 

Which kind of feature are you looking for?

Is it that you can popup "overlays" over the content? The XUL equivelant of overlays are panels. You can also easily add an iframe to XUL by using the HTML namespace. I would not recommend it though, but use some simple javascript to change the content of the panel instead.

You can also try with stack. Here is a small example :

<?xml version="1.0"?>
<!DOCTYPE window PUBLIC "-//MOZILLA//DTD XUL V1.0//EN" "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"&gt;
<?xml-stylesheet href="chrome://global/skin/global.css" type="text/css"?>
<window id="test"
        title="test"
        xmlns:html="http://www.w3.org/1999/xhtml"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     xmlns:svg="http://www.w3.org/2000/svg"&gt;
    <stack>
     <hbox>
      <vbox>
       <hbox>
        <label value="123"/>
       </hbox>
       <hbox>
        <label value="456"/>
       </hbox>
       <html:iframe style="width: 800px; height: 400px;" src="http://www.google.com"/&gt;
      </vbox>
     </hbox>
     <vbox style="position: absolute;opacity: 0.5;">
      <html:iframe style="position: absolute; top: 100px; left: 100px; width: 500px;" src="http://www.google.com"/&gt;
     </vbox>
    </stack>
</window>
lithorus
I was trying to put an IFRAME in a panel. But I found transparency didn't work. So I thought I'd put an IFRAME on one panel (opaque) and have a border image on a separate transparent panel. But then I found the panel always had a shadow. Lightboxes seemed an alternative if one worked in XUL.
Mat
Panels are still a bit different and the transparency is not always reliable. They are a way of representing menu's etc.What you can do is maybe try and use a stack and place your "popup" as a normal html inside that iframe. Not sure it'll work though, but worth a try.
lithorus
Just did a small test and it seems to work. Will update my answer to show you the source.
lithorus
I have no idea what this answer even means, but putting my to-be-popped-up XUL element as a child of Stack worked (I had, via guessing, put it as a child of a menupopup)...is there an up-to-date book on this stuff? How do you know about the stack? Thanks and +1, of course, though I see you've given up on a rather ungrateful SO community.
Yar
You can learn a lot from the XUL tutorial here :https://developer.mozilla.org/en/XUL_Tutorial/Stacks_and_DecksIn XUL there is no real equivalent to div's, but there are stacks, which stack thing on top of each other.
lithorus