Galleria not clearing caption
I am using Galleria and extending it to show the caption's created from image alt attributes. It works great, however if I choose to have no caption on one image, the caption from the image before is still visible, I notice also that the Galleria info container, where I get my captions from; doesn't update if the alt attribute is empty.
Is there any way to rectify this?
Here is my code.
jQuery("body").find('.galleria').ga开发者_开发问答lleria({
autoplay: false,
image_crop: false, // crop all images to fit
thumb_crop: false, // crop all thumbnails to fit
image_position: 'top left',
transition: 'fade', // crossfade photos
transition_speed: 700, // slow down the crossfade
show_counter: false, // crossfade photos
extend: function() {
this.bind(Galleria.IMAGE, function(e) {
var caption = this.$('info-description').html();
//alert(caption)
if(this.$('info-description').html() == ""){
jQuery("body").find('.caption').html();
}else{
jQuery("body").find('.caption').html(this.$('info-description').html());
}
})
}
});//end galleria
I know this is specialised but someone is bound to have come across this problem before. Any suggestions would be amazing.
All the best Tara
Try adding an empty string when you set the caption:
jQuery("body").find('.caption').html('');
If no string is specified in html(..)
then it returns the value instead of setting it.
精彩评论