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);
});
精彩评论