开发者

jquery if statement help with supersized plugin

I need help with the following piece of code, I would like to see if the current image is set, if not display default image instead.

This is my code:

jQuery(function($){
            $.supersized({
                slides  :   [ {image : '<?php echo get_post_meta($post->ID, 'upload_image', true); ?>' }开发者_运维百科 ]
            });
        });


Try this

jQuery(function(){
       var settings = {
                slides  :   [ {image : '<?php echo get_post_meta($post->ID, 'upload_image', true); ?>' } ]
            };

       if(!settings.slides[0].image)
          settings.slides[0].image = "setTheDefaultImageHere";

            $.supersized(settings);
        });
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜