;(function ($) {

    $('.elementor-section').each(function () {
        $(this).mousemove(function(e) {
            $(this).removeClass('pxl-section-mouseleave');
            let elParallax = $(this).find('.pxl-image-parallax .pxl-item--image, .pxl-parallax-hover');
            let section = $(this);
            if($(elParallax).length === 0) return;
            
            $(elParallax).each(function () {
                var el_move = $(this)
                var el_value = $(this).data('parallax-value');
                pxl_parallax_move(e, el_move, -el_value, section);
            });
        });
        $(this).mouseleave(function(e) {
            $(this).addClass('pxl-section-mouseleave');
        });
    });

    function pxl_parallax_move(e, target, movement, section) {

        var relX = e.pageX - section.offset().left;
        
        var relY = e.pageY - section.offset().top;

        TweenMax.to(target, 1, {
            x: (relX - section.width() / 2) / section.width() * movement,
            y: (relY - section.height() / 2) / section.height() * movement
        });
    
    }

})(jQuery);