THE PROBLEM WITH EXAMPLES 1 and 2 using the flowers below is that for the hover to work corrrectly you need to have the mouse indicator over the image during the hover and when the flower moves up or across the mouse indicator is no longer actually over the image. IT WORKS BETTER in example 3 with the train because the mouse indicator is always over the image during hover:
1
Hover over the images to activate the translate.
transform: translate (x, y);
x represents the number in pixels the object will move along the horizontal axis.
y represent the number in pixels the object will move along the vertical axis.
transform: translate (300px;);
The image moves from left to right on the x access.
transform:translate(300px);
transition-timing-function: ease;
transition-duration: 1s;
2
transform: translate(0px, -400px)
The image moves up on the y access. Use a positive number if you want it to move down.
The first set of styles will allows animation when the user rolls out:
#translate{
-moz-transition-timing-function: ease;
-moz-transition-duration: 1s;
-webkit-transition-timing-function: ease;
-webkit-transition-duration: 1s;
-ms-transition-timing-function: ease;
-ms-transition-duration: 1s;
-o-transition-timing-function:ease;
-o-transition-duration: 1s;
transition-timing-function: ease;
transition-duration: 1s;
}
These are the main set of styles that will trigger the transform on the hover. They were placed on the first image.
#translate:hover{
-moz-transform: translate(300px);
-moz-transition-timing-function: ease;
-moz-transition-duration: 1s;
-webkit-transform:translate(300px);
-webkit-transition-timing-function: ease;
-webkit-transition-duration: 1s;
-ms-transform:translate(300px);
-ms-transition-timing-function: ease;
-ms-transition-duration: 1s;
-o-transform:translate(300px);
-o-transition-timing-function: ease;
-o-transition-duration: 1s;
transform:translate(300px);
transition-timing-function: ease;
transition-duration: 1s;
}