PluginProbe
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor / 2.0.11
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor v2.0.11
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 / social-feed / frontend.js

frontend.js in Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor 2.0.11, at blocks/social-feed/frontend.js

45 lines 1.8 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 document.querySelectorAll('.bkbg-sf-wrapper').forEach(function (wrapper) {
5 var grid = wrapper.querySelector('.bkbg-sf-grid');
6 if (!grid) return;
7
8 /* Responsive columns from data attrs */
9 var colsTablet = grid.getAttribute('data-cols-tablet') || '2';
10 var colsMobile = grid.getAttribute('data-cols-mobile') || '1';
11
12 var styleEl = document.createElement('style');
13 styleEl.textContent = [
14 '@media(max-width:900px){.bkbg-sf-grid[data-cols-tablet="' + colsTablet + '"]{grid-template-columns:repeat(' + colsTablet + ',1fr)}}',
15 '@media(max-width:600px){.bkbg-sf-grid[data-cols-mobile="' + colsMobile + '"]{grid-template-columns:repeat(' + colsMobile + ',1fr)}}',
16 ].join('');
17 document.head.appendChild(styleEl);
18
19 /* Staggered entrance animation */
20 var cards = grid.querySelectorAll('.bkbg-sf-card');
21 if (!cards.length || !('IntersectionObserver' in window)) return;
22
23 cards.forEach(function (card) {
24 card.style.opacity = '0';
25 card.style.transform = 'translateY(18px)';
26 card.style.transition = 'opacity 0.48s ease, transform 0.48s ease';
27 });
28
29 var io = new IntersectionObserver(function (entries) {
30 entries.forEach(function (entry) {
31 if (!entry.isIntersecting) return;
32 var card = entry.target;
33 var idx = Array.prototype.indexOf.call(cards, card);
34 setTimeout(function () {
35 card.style.opacity = '1';
36 card.style.transform = 'translateY(0)';
37 }, idx * 70);
38 io.unobserve(card);
39 });
40 }, { threshold: 0.12 });
41
42 cards.forEach(function (card) { io.observe(card); });
43 });
44 })();
45