开发者

jquery if statement help with supersized plugin

开发者 https://www.devze.com 2023-03-26 23:17 出处:网络
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.

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

精彩评论

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