1( function( $ ) { 2 "use strict"; 3 4 function hoverImageParallax($scope) { 5 const els = $scope.find('.hover-image-parallax'); 6 if (!els.length) return; 7 els.each(function (i, element) { 8 const $el = $(element); 9 const $image = $el.find('img'); 10 11 $el.on('mousemove', function (e) { 12 const rect = element.getBoundingClientRect(); 13 const x = e.clientX - rect.left; 14 const y = e.clientY - rect.top; 15 16 const moveX = (x - rect.width / 2) * 0.15; 17 const moveY = (y - rect.height / 2) * 0.15; 18 19 gsap.to($image[0], { 20 x: -moveX, 21 y: -moveY, 22 scale: 1.25, 23 duration: 0.5, 24 ease: "none" 25 }); 26 }); 27 28 $el.on('mouseleave', function () { 29 gsap.to($image[0], { 30 x: 0, 31 y: 0, 32 scale: 1, 33 duration: 0.5, 34 ease: "none" 35 }); 36 }); 37 }); 38} 39 40 41 function parallaxScroll() { 42 const els = $('[data-parallax]'); 43 if(!els.length) return; 44 els.each(function(i, el) { 45 const params = $(el).data().parallax; 46 const parent = $(el).closest('.e-con.elementor-element'); 47 const x = parseFloat(params.x) || 0; 48 const y = parseFloat(params.y) || 0; 49 const rotate = parseFloat(params.rotate) || 0; 50 const scale = parseFloat(params.scale) || 1; 51 const opacity = parseFloat(params.opacity) || 1; 52 gsap.set(parent, {'overflow' : 'hidden'}); 53 if($(el).hasClass('e-con-background') || $(el).hasClass('parallax-fit-position')) { 54 if(x > 0) { 55 gsap.set(el, {left: -x}) 56 } 57 if(x < 0) { 58 gsap.set(el, {right: x}) 59 } 60 if(y > 0) { 61 gsap.set(el, {top: -y}) 62 } 63 if(y < 0) { 64 gsap.set(el, {bottom: y}) 65 } 66 } 67 gsap.to(el, { 68 x: x, 69 y: y, 70 rotate: rotate, 71 scale: scale, 72 opacity: opacity, 73 ease: "none", 74 duration: 0.25, 75 scrollTrigger: { 76 trigger: parent, 77 start: "top 90%", 78 end: "bottom 10%", 79 scrub: true, 80 // markers: true, 81 } 82 }); 83 }) 84 } 85 86 $( window ).on( 'elementor/frontend/init', function() { 87 elementorFrontend.hooks.addAction( `frontend/element_ready/pxl_portfolio.default`, function( $scope ) { 88 hoverImageParallax($scope); 89 }); 90 elementorFrontend.hooks.addAction( `frontend/element_ready/pxl_image.default`, function( $scope ) { 91 hoverImageParallax($scope); 92 }); 93 elementorFrontend.hooks.addAction( `frontend/element_ready/pxl_post.default`, function( $scope ) { 94 hoverImageParallax($scope); 95 }); 96 elementorFrontend.hooks.addAction( `frontend/element_ready/pxl_team.default`, function( $scope ) { 97 hoverImageParallax($scope); 98 }); 99 // elementorFrontend.hooks.addAction( `frontend/element_ready/pxl_play_video.default`, function( $scope ) { 100 // // hoverParallax($scope); 101 // }); 102 }); 103} )( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.