I've been working on this for a day. Looping thru an array of ids didn't work. queryAllSelectors didn't work. In both scenarios only the third of three divs is affected. I would love to get ByClassName work.
<header>
<div onmouseover="rotateYDIV()" class="rotate3D">Thing A</div>
<div onmouseover="rotateYDIV()" class="rotate3D">Thing B</div>
<div onmouseover="rotateYDIV()" class="rotate3D">Thing C</div>
</header>
header {
text-align: center;
}
div {
width: 100px;
height: 100px;
background: gray;
display: inline-block;
}
var y,n=0,ny=0,rotINT,rotYINT
function rotateYDIV()
{
y=document.getElementsByClassName("rotate3D");
clearInterval(rotYINT)
rotYINT=setInterval("startYRotate()",1)
}
function startYRotate()
{
ny=ny+1
y.style.transform="rotateY(" + ny + "deg)"
y.style.webkitTransform="rotateY(" + ny + "deg)"
y.style.OTransform="rotateY(" + ny + "deg)"
y.style.MozTransform="rotateY(" + ny + "deg)"
if (ny==180 || ny>=360)
{
clearInterval(rotYINT)
if (ny>=360){ny=0}
}
}