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 / gradient-blob / frontend.js

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

37 lines 1000 B
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 reducedMotion() {
5 return window.matchMedia && window.matchMedia('(prefers-reduced-motion: reduce)').matches;
6 }
7
8 function initBlob(section) {
9 var speed = parseFloat(section.dataset.speed) || 10;
10 var paused = section.dataset.paused === 'true';
11
12 if (reducedMotion()) {
13 // CSS handles it via @media, but also set JS flag
14 section.setAttribute('data-paused', 'true');
15 return;
16 }
17
18 // Sync animation speed from data attribute to CSS custom property
19 section.style.setProperty('--bkgb-speed', speed + 's');
20
21 if (paused) {
22 section.setAttribute('data-paused', 'true');
23 }
24 }
25
26 function init() {
27 document.querySelectorAll('.bkgb-section[data-speed]').forEach(initBlob);
28 }
29
30 if (document.readyState === 'loading') {
31 document.addEventListener('DOMContentLoaded', init);
32 } else {
33 init();
34 }
35
36 }());
37