views:

225

answers:

1

First, apologies. I'm a js newb.

I'm attempting to trigger a shadowbox with the load of a specific page - a "pop-up" if you will. Nothing happens and according to firebug, there are no errors to report.

I should note that this is wordpress, so I'm using the default jQuery call and also shadowbox rolled into a WP plug-in. Shadowbox does work properly in other areas of the site, as do jQuery functions.

noConflict() is used because WP also loads prototype by default, which conflicts with the jQuery dollar sign.

var $j = jQuery.noConflict();

        $j(function(){
            //Set cookie
                $j.cookie('padpop_viewed',true);

                    // open a welcome message as soon as the window loads
            $j(function() {
                Shadowbox.open({
                content: '<div width="600" height="460" style="margin:auto;"><a href="<?php  bloginfo('url');?>"/products/"><img src="<?php  bloginfo('template_url');?>/images/ipad-pop.jpg" width="600" height="460" alt="Redacted"/></a></div>',
                    player: "html",
                height: "470",
                width:  "610"
                });
            });
        });

Any help here would be greatly appreciated as I have spent hours consulting the documentation of each aspect of this.

Thanks, S.

+2  A: 

You should not nest $(function() { ... }) calls.

Remove the inner $j(function() {.

EDIT: and call

Shadowbox.init({
    // let's skip the automatic setup because we don't have any
    // properly configured link elements on the page
    skipSetup: true
});
SLaks
Done! But still no dice.
Shelton
Done. But still not working ... and now Shadowbox is not functioning where it previously had. I suspect that the WP plug-in makes the init call by default. I just made sure to put my code underneath the wp_head function.
Shelton