How do I get the position of an element after css3 translation in JavaScript? -
i saw posted in 2 different forms on stackoverflow, solutions don't work me.
essentially, have item translate. when obj.style.left or obj.offsetleft, after element has been translated, 0. there anyway can coordinates/position of element after has been translated css3?
i can't use jquery (because can't , because want understand solution, not use library without understanding happening underneath)
any ideas?
thanks much!
ok, hold tight because not nice:
window.addeventlistener('load', function(){ var node = document.getelementbyid("yourid"); var curtransform = new webkitcssmatrix(window.getcomputedstyle(node).webkittransform); console.log(node.offsetleft + curtransform.m41); //real offset left console.log(node.offsettop + curtransform.m42); //real offset top });
you can play here:
Comments
Post a Comment