Entrance Animations for Any Widget Or Container | Elementor Tutorial

Elementor 3.17 Update Broke My Forms — Here’s the Fix

Everything looks fine for about twelve seconds. Then the contact forms stop submitting. No error message. No console warning. Just… ...

Read More

My WordPress Site Got Hacked (Not My Fault — wp2shell Did It)

Someone just exploited a hole in WordPress core that lets them take over your server without logging in. Here's what ...

Read More

Elementor Update Just Broke My Site — Here’s How I Sorted It

Updated Elementor and your site broke? I walk through the actual fixes that worked when it happened to a client ...

Read More

How To Make A Vertical 3D Gallery Slider

So if you follow along in the video, I refer to this blog post for you to enter code at ...

Read More
Showing Slide 1 of 5

So if you follow along in the video, I refer to this blog post for you to enter code at certain points, so below is everything you will need!

Here are some masks to help you in this tutorial:

The Following are the css class names I used in the tutorial:

				
					custom-mask-entrance
				
			

The Following code goes into the HMTL widget:

				
					<script>

(function($) {
    $(document).ready(function() {
        const $containers = $('.custom-mask-entrance');
        
        const observer = new IntersectionObserver((entries) => {
            entries.forEach(entry => {
                if (entry.isIntersecting) {
                    const $target = $(entry.target);
                    const $before = window.getComputedStyle($target[0], '::before');
                    const beforeBg = $before.backgroundImage;
                    
                    if (beforeBg && beforeBg !== 'none') {
                        $target.css({
                            'mask-image': beforeBg,
                            '-webkit-mask-image': beforeBg,
                            'mask-size': 'cover',
                            '-webkit-mask-size': 'cover',
                            'mask-repeat': 'no-repeat',
                            '-webkit-mask-repeat': 'no-repeat',
                            'mask-position': 'center',
                            '-webkit-mask-position': 'center',
                            'opacity': '1'
                        });
                        
                        // Hide ::before after animation
                        setTimeout(() => {
                            $target.css('--before-opacity', '0');
                        }, 0.1); // Adjust timing as needed
                    }
                    
                    observer.unobserve(entry.target);
                }
            });
        }, {
            threshold: 0.2
        });

        // Add style for ::before opacity control
        const style = document.createElement('style');
        style.textContent = `
            .custom-viewport-mask-image {
                --before-opacity: 0;
            }
            .custom-viewport-mask-image::before {
                opacity: var(--before-opacity);
                transition: opacity 0.3s ease;
            }
        `;
        document.head.appendChild(style);

        $containers.each(function() {
            observer.observe(this);
        });
    });
})(jQuery);
</script>