When I use the following, an image slides gracefully out from the left, then snaps back to the left when the animation is done. It all happens at page load, automatically:
/* Chrome, Safari, Opera */
@-webkit-keyframes example {
from {
left: -275px;
width: 572px;
height: 894px;
}
to {
left: 200px;
width: 572px;
height: 894px;
}
}
/* Standard syntax */
@keyframes example {
from {
left: -275px;
width: 572px;
height: 894px;
}
to {
left: 200px;
width: 572px;
height: 894px;
}
}
Is it possible to initiate the above by clicking on a button? Or do we need to use JavaScript to make an image slide out and remain in place via a button?
One possible non-js solution, albeit not very semantic is to use hidden checkboxes/radio buttons.
say, something like:
<label for >Am the 'button'</lable> <!-- this can be anywhere in the code technically-->
<input type="checkbox" class="hideOffPage" Id="someName" class="animate">
<div> four stuff here </div><!-- this MUST follow directly after the input tag-->
. hideOffPage { position:absolute; left:-99999em;}
.animate:checked + div ( the rest of your selector ){ your styles;}
Of course this may limit legacy IE support ( to IE7/8 , I think) and FF3.5, Safari 3.1, etc…