You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having a problem and can't figure out the solution. When I click on a thumbnail image, the popup window appears that should display the larger image, but the image is missing, just the empty popup window appears. When I checked the console I saw this error message:
[Error] TypeError: Argument 1 ('child') to Node.removeChild must be an instance of Node
removeChild (baguetteBox.js:552)
(anonymous function) (baguetteBox.js:552)
Which is referring to this code in the baguetteBox.js file, the two >> indicated line 552.
// Prepare gallery img element
var image = create('img');
image.onload = function() {
// Remove loader element
var spinner = document.querySelector('#baguette-img-' + index + ' .baguetteBox-spinner');
>> figure.removeChild(spinner);
if (!options.async && callback) {
callback();
}
};
This is the HTML code I'm using to build the gallery images.
I'm loading the baguetteBox.css file in the <head> of my page, and executing this at the bottom of my page:
<script>baguetteBox.run('.gallery');</script>
I don't know what I'm doing wrong or why this started happening. I'm using this on a Bootstrap 4 website as well. Is there anything I can try to fix it? Thanks.
The text was updated successfully, but these errors were encountered:
Hello, I discovered the problem. There was another div that used the class "gallery" which was confusing the script, once I removed the extra one it worked again!
Attention people building Single Page Applications and other dynamic stuff:
If you call baguetteBox.initialize() more than once, with changing galleries - make sure to call baguetteBox.destroy() in-between! Else you will end up with this exact error (TypeError: Argument 1 ('child') to Node.removeChild must be an instance of Node).
E.g. in Vue, use mounted () {} for baguetteBox.initialize() and beforeUnmount () {} for baguetteBox.destroy().
If you stay in the same component, use a watch for baguetteBox.destroy(); baguetteBox.initialize();.
Depending on when and how you call destroy(), you might want to check if (document.getElementById('baguetteBox-overlay')) before calling baguetteBox.destroy(), as baguetteBox does not check by itself if it has even been initialized before destroying, and you will end up throwing a bunch of errors if you call destroy() before your first initialize().
Using baguettBox Version: 1.11.0
I'm having a problem and can't figure out the solution. When I click on a thumbnail image, the popup window appears that should display the larger image, but the image is missing, just the empty popup window appears. When I checked the console I saw this error message:
Which is referring to this code in the baguetteBox.js file, the two >> indicated line 552.
This is the HTML code I'm using to build the gallery images.
I'm loading the baguetteBox.css file in the
<head>
of my page, and executing this at the bottom of my page:I don't know what I'm doing wrong or why this started happening. I'm using this on a Bootstrap 4 website as well. Is there anything I can try to fix it? Thanks.
The text was updated successfully, but these errors were encountered: