{"id":975,"date":"2025-08-19T10:53:37","date_gmt":"2025-08-19T10:53:37","guid":{"rendered":"https:\/\/laywow.com\/animation\/parallax-effect-on-an-image\/"},"modified":"2025-09-17T15:08:47","modified_gmt":"2025-09-17T15:08:47","slug":"parallax-effect-on-an-image","status":"publish","type":"post","link":"https:\/\/laywow.com\/en\/animations\/parallax-effect-on-an-image\/","title":{"rendered":"Parallax Effect on an Image"},"content":{"rendered":"\n<p>The <strong>parallax<\/strong> effect adds depth to a website by making an image move slower than its container when scrolling. Here&#8217;s how to easily integrate it into <strong>Elementor<\/strong> using <strong>GSAP + ScrollTrigger<\/strong>.<\/p>\n\n<p><\/p>\n\n<h2 class=\"wp-block-heading\">Add the GSAP Code in Elementor<\/h2>\n\n<p>\ud83d\udc49 In Elementor:<\/p>\n\n<ul class=\"wp-block-list\">\n<li>Go to your <strong>WordPress dashboard<\/strong>.<\/li>\n\n\n\n<li>Navigate to <strong>Elementor &gt; Custom Code<\/strong>.<\/li>\n\n\n\n<li>Click on <strong>Add New Code<\/strong>.<\/li>\n\n\n\n<li>Name it, for example: <code>Effet de parallaxe sur une image<\/code>.<\/li>\n\n\n\n<li>Paste the following code, selecting the location <strong> &lt;\/body &#8211; End&gt;<\/strong> <img decoding=\"async\" width=\"150\" height=\"25\" class=\"wp-image-726\" style=\"width: 150px;\" src=\"https:\/\/laywow.com\/wp-content\/uploads\/2025\/08\/image-1.png\" alt=\"\" srcset=\"https:\/\/laywow.com\/wp-content\/uploads\/2025\/08\/image-1.png 348w, https:\/\/laywow.com\/wp-content\/uploads\/2025\/08\/image-1-300x50.png 300w\" sizes=\"(max-width: 150px) 100vw, 150px\" \/> :<\/li>\n<\/ul>\n\n<pre class=\"wp-block-code\"><code>&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/gsap\/3.9.1\/gsap.min.js\">&lt;\/script>\n&lt;script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/gsap\/3.9.1\/ScrollTrigger.min.js\">&lt;\/script>\n\n&lt;script>\ngsap.utils.toArray(\".section-parallax .parallax-content\").forEach((section, i) => {\n  const heightDiff = section.offsetHeight - section.parentElement.offsetHeight;\n  \n  gsap.fromTo(section,{ \n    y: -heightDiff\n  }, {\n    scrollTrigger: {\n      trigger: section,\n      scrub: true\n    },\n    y: 0,\n    ease: \"none\"\n  });\n});\n&lt;\/script><\/code><\/pre>\n\n<p><\/p>\n\n<h2 class=\"wp-block-heading\">Create the Structure in Elementor<\/h2>\n\n<h3 class=\"wp-block-heading\">Step 1: the Parent Container<\/h3>\n\n<ul class=\"wp-block-list\">\n<li>Add an Elementor <strong>container<\/strong>.<\/li>\n\n\n\n<li>Give it the CSS class: <code>section-parallax<\/code><\/li>\n\n\n\n<li>Set the container height to approximately <strong>80vh<\/strong> (smaller than the image to see the effect).<\/li>\n<\/ul>\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"662\" height=\"94\" src=\"https:\/\/laywow.com\/wp-content\/uploads\/2025\/08\/image-2.png\" alt=\"\" class=\"wp-image-730\" srcset=\"https:\/\/laywow.com\/wp-content\/uploads\/2025\/08\/image-2.png 662w, https:\/\/laywow.com\/wp-content\/uploads\/2025\/08\/image-2-300x43.png 300w\" sizes=\"(max-width: 662px) 100vw, 662px\" \/><\/figure>\n\n<h3 class=\"wp-block-heading\">Step 2: the Image<\/h3>\n\n<ul class=\"wp-block-list\">\n<li>Add an <strong>Image<\/strong> widget to this container.<\/li>\n\n\n\n<li>Give it the CSS class: <code>parallax-content<\/code><\/li>\n\n\n\n<li>In the image&#8217;s advanced settings:\n<ul class=\"wp-block-list\">\n<li><strong>Position<\/strong>: Absolute<\/li>\n\n\n\n<li><strong>Size<\/strong>: fully cover the container (width 100%, height auto or fixed).<\/li>\n\n\n\n<li><strong>Height<\/strong>: in the demo \u2192 approximately <strong>200vh<\/strong> (taller than the container to clearly see the offset).<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"667\" height=\"489\" src=\"https:\/\/laywow.com\/wp-content\/uploads\/2025\/08\/image-3.png\" alt=\"\" class=\"wp-image-732\" srcset=\"https:\/\/laywow.com\/wp-content\/uploads\/2025\/08\/image-3.png 667w, https:\/\/laywow.com\/wp-content\/uploads\/2025\/08\/image-3-300x220.png 300w\" sizes=\"(max-width: 667px) 100vw, 667px\" \/><\/figure>\n\n<p><\/p>\n\n<h2 class=\"wp-block-heading\">Expected Result<\/h2>\n\n<p>When you scroll, the image moves slower than the rest of the content \u2192 creating an elegant and modern <strong>depth effect<\/strong>.<\/p>\n\n<p><\/p>\n\n<h2 class=\"wp-block-heading\">Customize the Code<\/h2>\n\n<p>Let&#8217;s look at the key part:<\/p>\n\n<pre class=\"wp-block-code\"><code>gsap.fromTo(section,{ \n    y: -heightDiff\n  }, {\n    scrollTrigger: {\n      trigger: section,\n      scrub: true\n    },\n    y: 0,\n    ease: \"none\"\n});\n<\/code><\/pre>\n\n<h3 class=\"wp-block-heading\">Explanations:<\/h3>\n\n<ul class=\"wp-block-list\">\n<li><strong>y: -heightDiff<\/strong> \u2192 The image starts offset upwards by the difference between its size and the container&#8217;s.<\/li>\n\n\n\n<li><strong>y: 0<\/strong> \u2192 The image returns to its normal position during scrolling.<\/li>\n\n\n\n<li><strong>scrub: true<\/strong> \u2192 Synchronizes the animation with the scroll progress.<\/li>\n\n\n\n<li><strong>ease: &#8220;none&#8221;<\/strong> \u2192 No acceleration, the effect remains linear.<\/li>\n<\/ul>\n\n<h3 class=\"wp-block-heading\">Possible Customizations:<\/h3>\n\n<ol class=\"wp-block-list\">\n<li><strong>Change the scroll speed<\/strong>\n<ul class=\"wp-block-list\">\n<li>Replace <code>scrub: true<\/code> with <code>scrub: 1<\/code> or <code>scrub: 2<\/code> \u2192 adds an inertia effect (smoother).<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>Limit the trigger area<\/strong> <code>scrollTrigger: { trigger: section, start: \"top 80%\", \/\/ commence quand le container arrive \u00e0 80% du viewport end: \"bottom 20%\", \/\/ termine quand le bas atteint 20% scrub: true }<\/code><\/li>\n\n\n\n<li><strong>Add an easing for a smoother effect<\/strong> <code>ease: \"power2.out\"<\/code><\/li>\n\n\n\n<li><strong>Apply to multiple images<\/strong>\n<ul class=\"wp-block-list\">\n<li>The code <code>gsap.utils.toArray(\".section-parallax .parallax-content\")<\/code> already handles multiple sections automatically.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n<p><\/p>\n\n<p>\u2705 You can now create a modern and professional <strong>parallax<\/strong> effect on your images with Elementor + GSAP.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The parallax effect adds depth to a website by making an image move slower than its container when scrolling. Here&#8217;s how to easily integrate it into Elementor using GSAP + ScrollTrigger. Add the GSAP Code in Elementor \ud83d\udc49 In Elementor: Create the Structure in Elementor Step 1: the Parent Container Step 2: the Image Expected [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":969,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[25],"tags":[22],"class_list":["post-975","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-animations","tag-scroll"],"acf":[],"_links":{"self":[{"href":"https:\/\/laywow.com\/en\/wp-json\/wp\/v2\/posts\/975","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/laywow.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/laywow.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/laywow.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/laywow.com\/en\/wp-json\/wp\/v2\/comments?post=975"}],"version-history":[{"count":1,"href":"https:\/\/laywow.com\/en\/wp-json\/wp\/v2\/posts\/975\/revisions"}],"predecessor-version":[{"id":976,"href":"https:\/\/laywow.com\/en\/wp-json\/wp\/v2\/posts\/975\/revisions\/976"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/laywow.com\/en\/wp-json\/wp\/v2\/media\/969"}],"wp:attachment":[{"href":"https:\/\/laywow.com\/en\/wp-json\/wp\/v2\/media?parent=975"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/laywow.com\/en\/wp-json\/wp\/v2\/categories?post=975"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/laywow.com\/en\/wp-json\/wp\/v2\/tags?post=975"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}