Shadowbox 3 - Shadowbox.open() fails in Firefox "aa is undefined"

classic Classic list List threaded Threaded
5 messages Options
TSG
Reply | Threaded
Open this post in threaded view
|

Shadowbox 3 - Shadowbox.open() fails in Firefox "aa is undefined"

TSG
This post was updated on .
Hello,

this is the relevant html I use ( located in the head ):

<script language="javascript" type="text/javascript" src="mootools-1.2.4-core.js" charset="utf-8"></script><script language="javascript" type="text/javascript" src="mootools-1.2.4.4-more.js" charset="utf-8"></script><script language="javascript" type="text/javascript" src="shadowbox-moo.js" charset="utf-8"></script><script language="javascript" type="text/javascript" src="mymoo.js" charset="utf-8"></script>
"shadowbox-moo.js" is Shadowbox 3.03 with mootols adapter and without css selector build

This is my "mymoo.js" from above:

window.addEvent('domready', function(){

        var options = {
                players: ["img", "html"],
                animate: true,
                animSequence: 'wh',
                overlayColor: '#102F65',
                overlayOpacity: 0.35,
                listenOverlay: true,
                resizeDuration: 0.2,
                fadeDuration: 0.2,
                continuous: true,
                counterType: 'skip',
                enableKeys: true,
                loadingImage: '/design/altholstein/images/shadowbox/loading-light.gif',
                handleLgImages: 'resize'
        };
        Shadowbox.init(options);

        Shadowbox.open({
                content:    'Test Test Test This is html',
                player:     "html",
                title:      "Welcome"
        });
       
});


In IE8 it works Firefox 3.6 Fails with "aa is undefined aa.style.display = "block";

What might be wrong?

Thank you very much!
TSG
Reply | Threaded
Open this post in threaded view
|

SOLVED

TSG
Seems that I found the problem.

Shadowbox 3 does not work when called on domready in Firefox. With Shadowbox 2 that worked.

Switching from

window.addEvent('domready', function(){ ...

to

window.onload = function(){ ...

in the example above solved it.

Don't know if thats a bug, or if it's intented.
Reply | Threaded
Open this post in threaded view
|

Re: SOLVED

aleangelico
Yes, you are right, and this is just nuts!!!
I cannot understand why $(document).ready doesnt work but window.onload does, its crazy
I spent 1 hour just for this!!!

BTW, Thanks a lot! TSG
Reply | Threaded
Open this post in threaded view
|

Re: SOLVED

manfer
While shadowbox.open and shadowbox.setup need to be called when DOM is ready, I don't think shadowbox.init is intended to be used after document is ready. So I would move var options and shadowbox.init(options) outside any of those functions that waits for document to be ready.
Reply | Threaded
Open this post in threaded view
|

Re: Shadowbox 3 - Shadowbox.open() fails in Firefox "aa is undefined"

doub1ejack
In reply to this post by TSG
NOTE: you will see this exact same error ("aa is undefined") if Shadowbox.init() has not run before you attempt to open shadowbox.  This may not be the OP's problem, but other users may solve their issue this way.