开发者

Shadowbox + jQuery not working - No errors

开发者 https://www.devze.com 2023-01-01 16:27 出处:网络
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

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" hei开发者_Python百科ght="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.


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
});
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号