On Wordpress (latest version) I have this image I want to rotate when it's focused. I tried : focus but it did not work. Also tried class toggling as an alternative but somehow neither work...
1- I gave class ' Rotate45 ' to this image and wrote down this CSS
.Rotate45 {
-webkit-transition-duration: 1s;
-moz-transition-duration: 1s;
-o-transition-duration: 1s;
transition-duration: 1s;
-webkit-transition-property: -webkit-transform;
-moz-transition-property: -moz-transform;
-o-transition-property: -o-transform;
transition-property: transform;
outline: 0;
}
.Rotate45:focus {
-moz-transform: rotate(45deg);
-o-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
-ms-transform: rotate(45deg);
transform: rotate(45deg);
}
I don't understand why it does not work... if I replace :focus by :active or just remove :focus altogether it behaves as expected, but somehow not with :focus. I added attribute tabindex|1 as well but it fixes nothing.
2-As the focus: was not working, as an alternative, I replaced the first instance of Rotate45 by Rotate, changed the image class to Rotate, replaced Rotate45:focus by Rotate45, then added an HTML widget with the following toggleclass code
<script type="text/javascript">
$(".Rotate").click(function() {
$(".Rotate").toggleClass("Rotate45");
});
</script>
And still nothing, it's frustrating. Any help would be much appreciated Here is a link to the test page for reference.
PS: Am a total coding rookie and would like to learn some JS, PHP and JQuery