In my Android Hybrid app which uses Crosswalk need to apply a CSS3 transform to an HTML element at run time. I thought this was a relatively trival task but found that it simply would not work. Initially I suspected that this was down to a missing capability in the Crosswalk/Chromium implementation of the spec. However, to be safe I much the same thing in my desktop Chrome browser as shown below
document.getElementById('btn').addEventListener('click', transIt);
function transIt() {
alert('Transforming now!');
var blobStyle = document.getElementById('blob').style;
blobStyle.webkitTransform = 'translate(100px,50px);';
blobStyle.webkitTransform = 'translate(100px,50px);';
alert('Did it work?');
}
#main {
position: relative;
margin: auto;
margin-top: 20%;
height: 200px;
width: 50%;
border: 1px solid red;
border-radius: 8px;
box-sizing: border-box;
padding: 1em;
}
#blob {
position: absolute;
border: 1px solid blue;
background-color: blue;
border-radius: 2em;
height: 2em;
width: 2em;
left: calc(50% - 1em);
top: calc(50% - 1em);
}
<div id='main'>
<div id='blob'> </div>
</div>
<button id='btn'>Transform It</button>
Much to my surprise this relatively simple code does not deliver the intended results in Chrome on Windows either. Either I am doing something wrong here that I am unable to spot or else there are other underlying issues at work. Perhaps someone here might have an insight that I do not.