I have the following situation: I have a centered panoramic photo (the right and left parts of the image are not yet visible on the screen).
I would like, depending on the position of the mouse (relating to the middle X image) of the image:
-> moves (as if in a virtual tour) to the left (if the mouse is on the right side of the photo);
-> moves to the right (if the mouse is on the left side of the image);
-> and returns to its original position (when the mouse is outside the image).
This is how I tried (moving in one direction only, but I need / need two directions):
<head> <style type="text/css"> #smartdemo3 { width: 75%; overflow: hidden; } #smartdemo3 img:hover { transform: translate3d(-200px, 0px, 0px); transition: transform 5s linear; } #smartdemo3 img { transition: 4s all ease-in-out; } </style> </head> <body> <div id="smartdemo3"> <img src="../images/Panint1.jpg" /> </div> </body> </html>
How can i do this?
Thanks.
source share