PluginProbe
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor / 2.0.7
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor v2.0.7
2.0.13 2.0.12 2.0.11 2.0.10 2.0.9 trunk 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8
blockenberg / blocks / bento-grid / frontend.js

frontend.js in Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor 2.0.7, at blocks/bento-grid/frontend.js

39 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function () {
2 'use strict';
3
4 function initBentoGrid() {
5 var grids = document.querySelectorAll('.bkbg-bento-grid[data-animate="1"]');
6 if (!grids.length) return;
7
8 if (!('IntersectionObserver' in window)) {
9 grids.forEach(function (grid) {
10 grid.querySelectorAll('.bkbg-bento-cell').forEach(function (cell) {
11 cell.classList.add('is-visible');
12 });
13 });
14 return;
15 }
16
17 var obs = new IntersectionObserver(function (entries) {
18 entries.forEach(function (entry) {
19 if (entry.isIntersecting) {
20 entry.target.classList.add('is-visible');
21 obs.unobserve(entry.target);
22 }
23 });
24 }, { threshold: 0.12, rootMargin: '0px 0px -40px 0px' });
25
26 grids.forEach(function (grid) {
27 grid.querySelectorAll('.bkbg-bento-cell').forEach(function (cell) {
28 obs.observe(cell);
29 });
30 });
31 }
32
33 if (document.readyState === 'loading') {
34 document.addEventListener('DOMContentLoaded', initBentoGrid);
35 } else {
36 initBentoGrid();
37 }
38 }());
39