-
Notifications
You must be signed in to change notification settings - Fork 434
Description
I use BaguetteBox on my website.
Thank you for your superb work.
My photos do not have “data-caption.” I wanted to set up a counter in the style of “photo index number/total photos in the gallery.”
I modified part of the .js file for this.
Before: line 536
// Get element reference, optional caption and source path
var imageElement = galleryItem.imageElement;
var thumbnailElement = imageElement.getElementsByTagName('img')[0];
var imageCaption = typeof options.captions === 'function' ?
options.captions.call(currentGallery, imageElement) :
imageElement.getAttribute('data-caption') || imageElement.title;
var imageSrc = getImageSrc(imageElement);
// Prepare figure element
After modification :
// Get element reference, optional caption and source path
var imageElement = galleryItem.imageElement;
var thumbnailElement = imageElement.getElementsByTagName('img')[0];
/*var imageCaption = typeof options.captions === 'function' ?
options.captions.call(currentGallery, imageElement) :
imageElement.getAttribute('data-caption') || imageElement.title;
*/
var imageSrc = getImageSrc(imageElement);
/***change caption en compteur****/
var actuel = [index +1] ;
var imageCaption = actuel +'/' + currentGallery.length;
/******************************/
// Prepare figure element
I also modified the .css file to display the counter at the top of the window. But that's easy when you know how to use CSS.
Could my idea be part of a new version of baguetteBox?????