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 / video-testimonial / frontend.js

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

39 lines 1.7 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-vt-wrapper').forEach(function (wrapper) {
3 /* ── Video click → iframe inject ──────────────────────────────────── */
4 wrapper.querySelectorAll('.bkbg-vt-video-wrap').forEach(function (wrap) {
5 wrap.addEventListener('click', function () {
6 var embedUrl = wrap.getAttribute('data-embed');
7 if (!embedUrl) return;
8
9 var iframe = document.createElement('iframe');
10 iframe.src = embedUrl;
11 iframe.allow = 'autoplay; fullscreen';
12 iframe.allowFullscreen = true;
13
14 /* clear thumbnail + overlay, inject iframe */
15 while (wrap.firstChild) { wrap.removeChild(wrap.firstChild); }
16 wrap.appendChild(iframe);
17 wrap.style.cursor = 'default';
18 });
19 });
20
21 /* ── Animate on scroll ──────────────────────────────────────────────── */
22 var cards = wrapper.querySelectorAll('.bkbg-vt-card.bkbg-vt-anim');
23 if (!cards.length) return;
24
25 var io = new IntersectionObserver(function (entries) {
26 entries.forEach(function (entry, idx) {
27 if (entry.isIntersecting) {
28 setTimeout(function () {
29 entry.target.classList.add('bkbg-vt-visible');
30 }, idx * 90);
31 io.unobserve(entry.target);
32 }
33 });
34 }, { threshold: 0.1 });
35
36 cards.forEach(function (card) { io.observe(card); });
37 });
38 });
39