Skip to content

Commit d8ad2ca

Browse files
authored
Add option for custom buttons (#245)
Customize buttons using the following options: - leftArrow - rightArrow - closeX All options must be strings and valid HTML/SVG markup.
1 parent f3260fb commit d8ad2ca

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/baguetteBox.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@
4848
afterShow: null,
4949
afterHide: null,
5050
onChange: null,
51-
overlayBackgroundColor: 'rgba(0,0,0,.8)'
51+
overlayBackgroundColor: 'rgba(0,0,0,.8)',
52+
closeX: closeX,
53+
leftArrow: leftArrow,
54+
rightArrow: rightArrow
5255
};
5356
// Object containing information about features compatibility
5457
var supports = {};
@@ -398,6 +401,12 @@
398401
}
399402
// Set buttons style to hide or display them
400403
previousButton.style.display = nextButton.style.display = (options.buttons ? '' : 'none');
404+
// Set custom markup for buttons
405+
closeButton.innerHTML = options.closeX;
406+
if (options.buttons) {
407+
previousButton.innerHTML = options.leftArrow;
408+
nextButton.innerHTML = options.rightArrow;
409+
}
401410
// Set overlay color
402411
try {
403412
overlay.style.backgroundColor = options.overlayBackgroundColor;

0 commit comments

Comments
 (0)