onsa
12/16/2016 - 11:15 PM

Get style of an element no matter what the browser is.

Get style of an element no matter what the browser is.

function getStyle(element) {
	var myNav = navigator.userAgent.toLowerCase();
	//  if <IE9
	if (myNav.indexOf('msie') !== -1 && parseInt(myNav.split('msie')[1], 10) < 9) {
		return element.currentStyle;
	//  all else
	} else {
		return window.getComputedStyle(element);
	}
}