(This page includes affiliate links. If you click and purchase, I receive a small commission at no extra cost from you and that way you can support me. I only recommend tools that I have personally used and loved.)
Get Elementor Pro Today –
1 – Elementor Pro
Image Scroll effect with Elementor and CSS
There are two versions available below, first version allows you to scroll longer image with scrollbar and second version simply scrolls the image automatically if you hover on it. For the second version, some extra configuration might require if you change the container height, so watch above video to learn it.
![DMmotionarts Logo transparent](https://dmmotionarts.com/wp-content/uploads/2022/11/DMmotionarts-Logo-transparent-1024x1024.png)
![DMmotionarts Logo transparent](https://dmmotionarts.com/wp-content/uploads/2022/11/DMmotionarts-Logo-transparent-1024x1024.png)
![](https://dmmotionarts.com/wp-content/uploads/2024/03/pexels-norma-mortenson-7301569-4.jpg)
![](https://dmmotionarts.com/wp-content/uploads/2024/03/pexels-ivan-xolod-8602123-3.jpg)
- dm-eye is the CSS class of the element that requires track/follow effect.
- Simply change the value from 20 to your desired value to control how strong the track/follow should be at
const dmEyeX = (mouseX – dmEyeRect.x) / 20;
const dmEyeY = (mouseY – dmEyeRect.y) / 20; - Simply add negative(-) sign before dmEyeX or dmEyeY to make track/follow be at opposite direction of mouse cursor.
dmEye.style.transform = `translate(${dmEyeX}px, ${dmEyeY}px)`;
- To add more elements with different track/follow strengths or different track/follow directions. Simply add the below code with changes every time at appropriate locations. You can copy this code multiple times but make sure to change names accordingly.
- Add line number 1 below line 18 in above code.
- Add line number 3 -10 below line number 31 in above code = after first });
- Add any name at secondElements , I have added “s” at the end for easy coding. Also change .second-element to the CSS class used for element.
- Replace secondElements to the name you have used, only in line 3 below. (only first one)
- Replace secondElement (not secondElements), to your desired name. Here I have used secondElement without s for easy coding.
- Replace secondElementRect, secondElementX, secondElementY with your desired name and make sure it is same wherever it is used.
const secondElements = document.querySelectorAll('.second-element');
secondElements.forEach(secondElement => {
const secondElementRect = secondElement.getBoundingClientRect();
const secondElementX = (mouseX - secondElementRect.x) / 20;
const secondElementY = (mouseY - secondElementRect.y) / 20;
secondElement.style.transform = `translate(${secondElementX}px, ${secondElementY}px)`;
});