I have the following CSS:
.makebig {
-webkit-animation-name: cssAnimation;
-webkit-animation-duration: 1s;
-webkit-animation-iteration-count: 1;
-webkit-animation-timing-function: ease;
-webkit-animation-fill-mode: forwards;
}
@-webkit-keyframes cssAnimation {
from {
-webkit-transform: rotate(0deg) scale(1) skew(0deg) translate(0px);
}
to {
-webkit-transform: rotate(0deg) scale(2) skew(0deg) translate(150px);
}
}
.makesmall {
-webkit-animation-name: cssAnimation1;
-webkit-animation-duration: 1s;
-webkit-animation-iteration-count: 1;
-webkit-animation-timing-function: ease;
-webkit-animation-fill-mode: forwards;
}
@-webkit-keyframes cssAnimation1 {
from {
-webkit-transform: rotate(0deg) scale(2) skew(0deg) translate(150px);
}
to {
-webkit-transform: rotate(0deg) scale(1) skew(0deg) translate(0px);
}
}
And this Javascript:
<script>
function ani(fns1) {
if (document.getElementById('fns1').getAttribute('clicked') == 'false')
{
document.getElementById('fns1').className = 'makebig';
document.getElementById('fns1').setAttribute('clicked', true);
} else {
document.getElementById('fns1').className = 'makesmall';
document.getElementById('fns1').setAttribute('clicked', false);
}
}
</script>
The code scales the object in two times. How can I send different 'scale' parameters based on the object?
I use it for the images to enlarge onclick and go to original scale on the second click. My images has different size and position in the text, so i need to make them scaled in center of the screen.