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 / feature-tabs / frontend.js

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

46 lines 1.5 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.addEventListener('DOMContentLoaded', function () {
5 initFeatureTabs();
6 });
7
8 function initFeatureTabs() {
9 document.querySelectorAll('.bkbg-ftb-wrapper').forEach(function (wrapper) {
10 var tabBtns = wrapper.querySelectorAll('.bkbg-ftb-tab-btn');
11 var panels = wrapper.querySelectorAll('.bkbg-ftb-panel');
12 var animate = wrapper.dataset.animate === '1';
13
14 if (!tabBtns.length || !panels.length) return;
15
16 function activateTab(btn, idx) {
17 tabBtns.forEach(function (b) {
18 b.classList.remove('is-active');
19 b.setAttribute('aria-selected', 'false');
20 });
21 panels.forEach(function (p) {
22 p.classList.remove('is-active');
23 p.setAttribute('aria-hidden', 'true');
24 });
25
26 btn.classList.add('is-active');
27 btn.setAttribute('aria-selected', 'true');
28
29 var target = Array.from(panels).find(function (p) {
30 return p.dataset.panel === btn.dataset.tab;
31 });
32 if (target) {
33 target.classList.add('is-active');
34 target.setAttribute('aria-hidden', 'false');
35 }
36 }
37
38 tabBtns.forEach(function (btn, idx) {
39 btn.addEventListener('click', function () {
40 activateTab(btn, idx);
41 });
42 });
43 });
44 }
45 })();
46