Getting actual widh/height values of element via attributes.getNamedItem
var event = e || window.event;
var target = event.target || event.srcElement;
i am getting id and class information by using
var classinfo = target.attributes.getNamedItem("class").nodeValue;
var idinfo = targe开发者_运维问答t.attributes.getNamedItem("id").nodeValue;
element.offsetWidth, element.offsetHeight: overall size of the containing box in pixels
element.clientHeight, element.clientWidth: content dimensions
These are read only properties, and always return the current rendered values.
(You need to assign a style property in the element or in a stylesheet to set most elements onscreen height and width.)
精彩评论