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 / hotspot-image / frontend.js

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

33 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /* Hotspot Image — frontend.js */
2 ( function () {
3 function init() {
4 document.querySelectorAll( '.bkhi-wrap' ).forEach( function ( wrap ) {
5 const trigger = wrap.dataset.trigger || 'hover';
6 const pins = Array.from( wrap.querySelectorAll( '.bkhi-pin' ) );
7
8 if ( trigger === 'click' ) {
9 pins.forEach( function ( pin ) {
10 pin.querySelector( '.bkhi-dot' ).addEventListener( 'click', function (e) {
11 e.stopPropagation();
12 const isActive = pin.classList.contains( 'bkhi-active' );
13 // close all
14 pins.forEach( p => p.classList.remove( 'bkhi-active' ) );
15 if ( ! isActive ) pin.classList.add( 'bkhi-active' );
16 } );
17 } );
18 // click outside closes
19 document.addEventListener( 'click', function () {
20 pins.forEach( p => p.classList.remove( 'bkhi-active' ) );
21 } );
22 }
23 // hover is handled by CSS :hover
24 } );
25 }
26
27 if ( document.readyState === 'loading' ) {
28 document.addEventListener( 'DOMContentLoaded', init );
29 } else {
30 init();
31 }
32 }() );
33