# blockenberg/2.0.7/blocks/chat-bubble/frontend.js

Blockenberg — 600+ Advanced Gutenberg Blocks &amp; AI Agent for WordPress Block Editor, version 2.0.7. 42 lines.

- Page: https://pluginprobe.com/plugins/blockenberg/2.0.7/code/blocks/chat-bubble/frontend.js
- Raw: https://pluginprobe.com/plugins/blockenberg/2.0.7/raw/blocks/chat-bubble/frontend.js
- Modified: 2026-03-06T12:32:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/blockenberg/2.0.7/code/blocks/chat-bubble/frontend.js#L10-L20`.

```javascript
(function () {
    'use strict';

    // Chat Bubbles — animate messages into view on scroll
    function initChatBubbles() {
        var containers = document.querySelectorAll('.bkbg-chat-container');
        if (!containers.length) return;

        if (!('IntersectionObserver' in window)) return;

        var obs = new IntersectionObserver(function (entries) {
            entries.forEach(function (entry) {
                if (!entry.isIntersecting) return;
                var messages = entry.target.querySelectorAll('.bkbg-chat-msg');
                messages.forEach(function (msg, idx) {
                    setTimeout(function () {
                        msg.style.opacity = '1';
                        msg.style.transform = 'translateY(0)';
                    }, idx * 80);
                });
                obs.unobserve(entry.target);
            });
        }, { threshold: 0.15 });

        containers.forEach(function (container) {
            var messages = container.querySelectorAll('.bkbg-chat-msg');
            messages.forEach(function (msg) {
                msg.style.opacity = '0';
                msg.style.transform = 'translateY(16px)';
                msg.style.transition = 'opacity 0.35s ease, transform 0.35s ease';
            });
            obs.observe(container);
        });
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', initChatBubbles);
    } else {
        initChatBubbles();
    }
}());

```
