מי לא אוהב לחגוג? יש משהו בקונפטי הצבעוני שמתפזר באוויר שגורם לנו פשוט לחייך. עכשיו תארו לעצמכם שאתם יכולים להביא את התחושה הזו, ההתרגשות, השמחה, הרגע המיוחד, ישירות לתוך האתר של הלקוחות שלכם.

במדריך הזה משתף בטריק קטן אבל מדליק: איך להוסיף אפקט קונפטי שיגרום למבקרים שלכם להרגיש את הרגע הקסום. הכי כיף כשהאפקט מופעל בדיוק ברגע הנכון, לדוגמה בלחיצה על כפתור, אחרי שליחת טופס או אחרי רכישה.

קונפטי בכניסה לעמוד

אפקט קונפטי שמופעל אוטומטית ברגע שהעמוד נטען, קבלת פנים חגיגית במיוחד! מושלם לעמודי נחיתה, מבצעים מיוחדים או השקת מוצר. הקונפטי "מתעופף" משני צדי המסך למשך כ-2 שניות, מושך את העין ויוצר אווירה חגיגית מהרגע הראשון.

את הקוד תטמיעו באלמנטור תחת ניהול קודים.

<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.4.0/dist/confetti.browser.min.js"></script>

<script>
/**
 * Draggable Elements Handler for Elementor
 * Developed by Twist | https://twist-digital.co.il/ 
 */
 
document.addEventListener('DOMContentLoaded', function() {
    // 1. Create a canvas element that will contain the confetti
    const canvasElement = document.createElement('canvas');
    canvasElement.className = 'confetti-canvas';
    canvasElement.style.position = 'fixed';
    canvasElement.style.top = '0';
    canvasElement.style.left = '0';
    canvasElement.style.width = '100%';
    canvasElement.style.height = '100%';
    canvasElement.style.pointerEvents = 'none';
    canvasElement.style.zIndex = '9999';
    document.body.appendChild(canvasElement);

    // 2. Load the confetti library
    if (typeof confetti === 'undefined') {
        const script = document.createElement('script');
        script.src = 'https://cdn.jsdelivr.net/npm/canvas-confetti@1.4.0/dist/confetti.browser.min.js';
        document.head.appendChild(script);
        
        // Wait for the script to load before initializing confetti
        script.onload = initConfetti;
    } else {
        // Library already loaded
        initConfetti();
    }
    
    // Function to initialize and run the confetti effect
    function initConfetti() {
        try {
            // Create the confetti object using our canvas
            const myConfetti = confetti.create(canvasElement, { resize: true });
            
            // Duration of the effect
            const end = Date.now() + 10 * 200;
            
            // Confetti colors
            const colors = ["#EAC5FB", "#1EEFEB"];
            
            // Run the animation
            (function frame() {
                myConfetti({
                    particleCount: 2,
                    angle: 60,
                    spread: 55,
                    origin: { x: 0 },
                    colors: colors,
                });
                myConfetti({
                    particleCount: 2,
                    angle: 120,
                    spread: 55,
                    origin: { x: 1 },
                    colors: colors,
                });
                
                // Continue the animation until time runs out
                if (Date.now() < end) {
                    requestAnimationFrame(frame);
                }
            })();
        } catch (error) {
            console.error("Confetti error:", error);
        }
    }
});
</script>
Expand

קונפטי בלחיצה על כפתור

הקונפטי כאן מופעל רק כאשר המשתמש לוחץ על כפתור מסוים (עם ID ייחודי). זה נהדר לכפתורי הרשמה, רכישה או כל כפתור CTA שאתם רוצים שיקבל תשומת לב. הקונפטי יוצר חיזוק חיובי, מגביר אינטראקציה ונותן למשתמש תחושת הישג קטנה, וזה שווה הרבה.

את הקוד תטמיעו באלמנטור תחת ניהול קודים, ואל תשכחו להוסיף את ה, ID לכפתור: confeti-button

<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.4.0/dist/confetti.browser.min.js"></script>

<script>

/**
 * Draggable Elements Handler for Elementor
 * Developed by Twist | https://twist-digital.co.il/ 
 */
 
document.addEventListener('DOMContentLoaded', function() {
    // 1. Create a canvas element that will contain the confetti
    const canvasElement = document.createElement('canvas');
    canvasElement.className = 'confetti-canvas';
    canvasElement.style.position = 'fixed';
    canvasElement.style.top = '0';
    canvasElement.style.left = '0';
    canvasElement.style.width = '100%';
    canvasElement.style.height = '100%';
    canvasElement.style.pointerEvents = 'none';
    canvasElement.style.zIndex = '9999';
    document.body.appendChild(canvasElement);

    // 2. Load the confetti library
    const script = document.createElement('script');
    script.src = 'https://cdn.jsdelivr.net/npm/canvas-confetti@1.4.0/dist/confetti.browser.min.js';
    document.head.appendChild(script);
    
    // 3. Set up the effect once the library is loaded
    script.onload = function() {
        // Create the confetti object
        const myConfetti = confetti.create(canvasElement, { resize: true });
        
        // Find the button by ID
        const button = document.getElementById('confeti-button');
        
        // Add click event to the button
        button.addEventListener('click', function() {
            // Duration of the effect
            const end = Date.now() + 2 * 90;
            
            // Confetti colors
            const colors = ["#EAC5FB", "#1EEFEB"];
            
            // Run the animation
            (function frame() {
                myConfetti({
                    particleCount: 2,
                    angle: 60,
                    spread: 55,
                    origin: { x: 0 },
                    colors: colors,
                });
                myConfetti({
                    particleCount: 2,
                    angle: 120,
                    spread: 55,
                    origin: { x: 1 },
                    colors: colors,
                });
                
                // Continue the animation until time runs out
                if (Date.now() < end) {
                    requestAnimationFrame(frame);
                }
            })();
        });
    };
});
</script>
Expand

קונפטי אחרי שליחת טופס

רגע אחרי שמבקר ממלא טופס ושולח, קונפטי! בדיוק ככה מוסיפים קסם למשהו שיכול להיות שגרתי. הקוד מזהה ששליחת הטופס באלמנטור הסתיימה בהצלחה, ואז מפעיל את האפקט. זה הופך את החוויה לאישית ומשמחת, הרבה יותר מהודעת תודה סטנדרטית.

את הקוד תטמיעו באלמנטור תחת ניהול קודים.

<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.4.0/dist/confetti.browser.min.js"></script>

<script>

/**
 * Draggable Elements Handler for Elementor
 * Developed by Twist | https://twist-digital.co.il/ 
 */
 
 document.addEventListener('DOMContentLoaded', function() {
    // 1. Create a canvas element that will contain the confetti
    const canvasElement = document.createElement('canvas');
    canvasElement.className = 'confetti-canvas';
    canvasElement.style.position = 'fixed';
    canvasElement.style.top = '0';
    canvasElement.style.left = '0';
    canvasElement.style.width = '100%';
    canvasElement.style.height = '100%';
    canvasElement.style.pointerEvents = 'none';
    canvasElement.style.zIndex = '9999';
    document.body.appendChild(canvasElement);

    // 2. Load the confetti library
    const script = document.createElement('script');
    script.src = 'https://cdn.jsdelivr.net/npm/canvas-confetti@1.4.0/dist/confetti.browser.min.js';
    document.head.appendChild(script);
    
    // 3. Set up the effect once the library is loaded
    script.onload = function() {
        // Create the confetti object
        const myConfetti = confetti.create(canvasElement, { resize: true });
        
        // Listen for Elementor form submissions
        jQuery(document).on('submit_success', function(event) {
            // Duration of the effect
            const end = Date.now() + 10 * 200;
            
            // Confetti colors
            const colors = ["#EAC5FB", "#1EEFEB"];
            
            // Run the animation
            (function frame() {
                myConfetti({
                    particleCount: 2,
                    angle: 60,
                    spread: 55,
                    origin: { x: 0 },
                    colors: colors,
                });
                myConfetti({
                    particleCount: 2,
                    angle: 120,
                    spread: 55,
                    origin: { x: 1 },
                    colors: colors,
                });
                
                // Continue the animation until time runs out
                if (Date.now() < end) {
                    requestAnimationFrame(frame);
                }
            })();
        });
    };
});
</script>
Expand

קונפטי אחרי רכישת מוצר

האפקט מופעל בעמוד "תודה לאחר הרכישה" של ווקומרס. ברגע שהלקוח מסיים את הרכישה, הוא מקבל אפקט קונפטי צבעוני במסך. דרך ויזואלית מצוינת להגיד: "תודה שקניתם אצלנו!" ולהשאיר רושם נהדר.

את הקוד תטמיעו באלמנטור תחת ניהול קודים.

<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.4.0/dist/confetti.browser.min.js"></script>

<script>


/**
 * Draggable Elements Handler for Elementor
 * Developed by Twist | https://twist-digital.co.il/ 
 */
 
document.addEventListener('DOMContentLoaded', function() {
    // Check if we're on the WooCommerce thank you page 
    // (You can also use other e-commerce hooks depending on your shop system)
    if (
        document.body.classList.contains('woocommerce-order-received') || 
        document.body.classList.contains('woocommerce-checkout') && document.querySelector('.woocommerce-thankyou-order-received') ||
        window.location.href.includes('/checkout/order-received/') ||
        window.location.href.includes('/thank-you/')
    ) {
        // 1. Create a canvas element that will contain the confetti
        const canvasElement = document.createElement('canvas');
        canvasElement.className = 'confetti-canvas';
        canvasElement.style.position = 'fixed';
        canvasElement.style.top = '0';
        canvasElement.style.left = '0';
        canvasElement.style.width = '100%';
        canvasElement.style.height = '100%';
        canvasElement.style.pointerEvents = 'none';
        canvasElement.style.zIndex = '9999';
        document.body.appendChild(canvasElement);

        // 2. Load the confetti library
        if (typeof confetti === 'undefined') {
            const script = document.createElement('script');
            script.src = 'https://cdn.jsdelivr.net/npm/canvas-confetti@1.4.0/dist/confetti.browser.min.js';
            document.head.appendChild(script);
            
            // Wait for the script to load before initializing confetti
            script.onload = initConfetti;
        } else {
            // Library already loaded
            initConfetti();
        }
        
        // Function to initialize and run the confetti effect
        function initConfetti() {
            try {
                // Create the confetti object using our canvas
                const myConfetti = confetti.create(canvasElement, { resize: true });
                
                // Make confetti effect more celebratory for purchases
                const end = Date.now() + 3000; // Longer duration, 3 seconds
                
                // More festive colors for purchase celebration
                const colors = ["#EAC5FB", "#1EEFEB", "#FFD700", "#FF4500"];
                
                // Run the animation
                (function frame() {
                    myConfetti({
                        particleCount: 4, // More particles
                        angle: 60,
                        spread: 70, // Wider spread
                        origin: { x: 0 },
                        colors: colors,
                    });
                    myConfetti({
                        particleCount: 4, // More particles
                        angle: 120,
                        spread: 70, // Wider spread
                        origin: { x: 1 },
                        colors: colors,
                    });
                    
                    // Continue the animation until time runs out
                    if (Date.now() < end) {
                        requestAnimationFrame(frame);
                    }
                })();
            } catch (error) {
                console.error("Confetti error:", error);
            }
        }
    }
});
</script>
Expand

רוצים גם אתר שיגרום למבקרים לחייך?

אם בא לכם אתר שירגיש וייראה בדיוק כמו שצריך להיראות, דברו איתי! נבנה לכם אתר אינטראקטיבי, מעוצב ומדויק לעסק שלכם.