| 1 |
/* Content Flip Box — frontend.js |
| 2 |
Handles click-trigger flip behaviour. |
| 3 |
Hover-trigger blocks are handled entirely in CSS. |
| 4 |
*/ |
| 5 |
(function () { |
| 6 |
'use strict'; |
| 7 |
|
| 8 |
function initFlipBoxes() { |
| 9 |
document.querySelectorAll('.bkbg-cfb-grid[data-trigger="click"]').forEach(function (grid) { |
| 10 |
grid.querySelectorAll('.bkbg-cfb-card').forEach(function (card) { |
| 11 |
card.addEventListener('click', function () { |
| 12 |
card.classList.toggle('is-flipped'); |
| 13 |
}); |
| 14 |
card.style.cursor = 'pointer'; |
| 15 |
}); |
| 16 |
}); |
| 17 |
} |
| 18 |
|
| 19 |
if (document.readyState === 'loading') { |
| 20 |
document.addEventListener('DOMContentLoaded', initFlipBoxes); |
| 21 |
} else { |
| 22 |
initFlipBoxes(); |
| 23 |
} |
| 24 |
})(); |
| 25 |
|