check if captions exists
This commit is contained in:
parent
8464ffe6ad
commit
9919d80782
@ -1517,27 +1517,30 @@
|
|||||||
function setCaption(caption) {
|
function setCaption(caption) {
|
||||||
var captions = getElement(config.selectors.captions);
|
var captions = getElement(config.selectors.captions);
|
||||||
var content = document.createElement('span');
|
var content = document.createElement('span');
|
||||||
|
if(captions) {
|
||||||
|
|
||||||
// Empty the container
|
// Empty the container
|
||||||
captions.innerHTML = '';
|
captions.innerHTML = '';
|
||||||
|
|
||||||
// Default to empty
|
// Default to empty
|
||||||
if (is.undefined(caption)) {
|
if (is.undefined(caption)) {
|
||||||
caption = '';
|
caption = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the span content
|
// Set the span content
|
||||||
if (is.string(caption)) {
|
if (is.string(caption)) {
|
||||||
content.innerHTML = caption.trim();
|
content.innerHTML = caption.trim();
|
||||||
} else {
|
} else {
|
||||||
content.appendChild(caption);
|
content.appendChild(caption);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set new caption text
|
||||||
|
captions.appendChild(content);
|
||||||
|
|
||||||
|
// Force redraw (for Safari)
|
||||||
|
var redraw = captions.offsetHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set new caption text
|
|
||||||
captions.appendChild(content);
|
|
||||||
|
|
||||||
// Force redraw (for Safari)
|
|
||||||
var redraw = captions.offsetHeight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Captions functions
|
// Captions functions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user