Hi all,
I added two popups (via templates) to my template and I want to open them by using javascript. It depends on the url of the website if the script needs to open a popup or not. So far so good…
But I can’t get the javascript to open the popup! It says that it opens it but it doesn’t. I tried different variations of code, but none of them worked for me. Also very important to mention: I set the popups to show everywhere, so that cant be the problem.
A example of code that i used:
<script>
document.addEventListener('DOMContentLoaded', (event) => {
console.log(typeof bricksOpenPopup);
console.log('Attempting to open popup with ID 19801...');
bricksOpenPopup('19801');
bricksOpenPopup(19801);
console.log('Just loaded popup');
});
document.addEventListener('bricks/popup/open', function(e) {
console.log(typeof bricksOpenPopup);
console.log('Popup opened', e.detail);
});
document.addEventListener('DOMContentLoaded', (event) => {
console.log(typeof bricksOpenPopup);
bricksOpenPopup('19801');
});
</script>
Hope any of you has a great idea!
Greetings,
A happy Bricks user!