PluginProbe
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor / 2.0.13
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor v2.0.13
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 / tech-stack / frontend.js

frontend.js in Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor 2.0.13, at blocks/tech-stack/frontend.js

30 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 wp.domReady(function () {
2 document.querySelectorAll('.bkbg-ts-wrapper').forEach(function (wrapper) {
3 /* ── Color-on-hover: grayscale toggle ─────────────────────────────── */
4 if (wrapper.classList.contains('bkbg-ts-color-on-hover')) {
5 wrapper.querySelectorAll('.bkbg-ts-item img').forEach(function (img) {
6 var parent = img.closest('.bkbg-ts-item');
7 parent.addEventListener('mouseenter', function () { img.style.filter = 'none'; });
8 parent.addEventListener('mouseleave', function () { img.style.filter = 'grayscale(100%)'; });
9 });
10 }
11
12 /* ── Animate on scroll ──────────────────────────────────────────────── */
13 var items = wrapper.querySelectorAll('.bkbg-ts-item.bkbg-ts-anim');
14 if (!items.length) return;
15
16 var io = new IntersectionObserver(function (entries) {
17 entries.forEach(function (entry, idx) {
18 if (entry.isIntersecting) {
19 setTimeout(function () {
20 entry.target.classList.add('bkbg-ts-visible');
21 }, idx * 60);
22 io.unobserve(entry.target);
23 }
24 });
25 }, { threshold: 0.1 });
26
27 items.forEach(function (item) { io.observe(item); });
28 });
29 });
30