Add wait for for lightgallery setup too
This commit is contained in:
parent
e51f08c83a
commit
1ff9567ba2
1 changed files with 11 additions and 9 deletions
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
var Clipboard = require('clipboard');
|
var Clipboard = require('clipboard');
|
||||||
|
|
||||||
function waitFor(global, callback) {
|
function waitFor(obj, property, callback) {
|
||||||
// Wait for a property to exist on window before runnig callback
|
// Wait for a property to exist on window before runnig callback
|
||||||
var intervalId = setInterval(function () {
|
var intervalId = setInterval(function () {
|
||||||
if (window[global]) {
|
if (obj.hasOwnProperty(property)) {
|
||||||
clearInterval(intervalId);
|
clearInterval(intervalId);
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
@ -24,12 +24,14 @@ $('.image').each(function () { // setup div-image hybrids
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('#light-gallery').lightGallery({
|
waitFor($.fn, 'lightGallery', function () {
|
||||||
thumbnail:true,
|
$('#light-gallery').lightGallery({
|
||||||
animateThumb: false,
|
thumbnail:true,
|
||||||
showThumbByDefault: false,
|
animateThumb: false,
|
||||||
preload: 2,
|
showThumbByDefault: false,
|
||||||
download: false
|
preload: 2,
|
||||||
|
download: false
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// HACK: ToC has blank li if no initial header
|
// HACK: ToC has blank li if no initial header
|
||||||
|
@ -42,7 +44,7 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
waitFor('mermaid', function () {
|
waitFor(window, 'mermaid', function () {
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
startOnLoad: true
|
startOnLoad: true
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue