jquery Programming Glossary: styleprop
Get computed font size for DOM element in JS http://stackoverflow.com/questions/1955048/get-computed-font-size-for-dom-element-in-js getComputedStyle method if available function getStyle el styleProp var camelize function str return str.replace w g function str.. if el.currentStyle return el.currentStyle camelize styleProp else if document.defaultView document.defaultView.getComputedStyle.. el null .getPropertyValue styleProp else return el.style camelize styleProp Usage var element document.getElementById..
Retrieving percentage CSS values (in firefox) http://stackoverflow.com/questions/8387419/retrieving-percentage-css-values-in-firefox demo http jsfiddle.net steweb tUAKA function getStyle el styleProp from ppk's quirksmode var x document.getElementById el if x.currentStyle.. el if x.currentStyle var y x.currentStyle styleProp else if window.getComputedStyle var y document.defaultView.getComputedStyle.. x null .getPropertyValue styleProp return y var left getStyle 'box' 'left' But if you try it on..
Get computed font size for DOM element in JS http://stackoverflow.com/questions/1955048/get-computed-font-size-for-dom-element-in-js property otherwise you can look for the DOM Level 2 standard getComputedStyle method if available function getStyle el styleProp var camelize function str return str.replace w g function str letter return letter.toUpperCase if el.currentStyle return.. str.replace w g function str letter return letter.toUpperCase if el.currentStyle return el.currentStyle camelize styleProp else if document.defaultView document.defaultView.getComputedStyle return document.defaultView.getComputedStyle el null.. document.defaultView.getComputedStyle return document.defaultView.getComputedStyle el null .getPropertyValue styleProp else return el.style camelize styleProp Usage var element document.getElementById 'elementId' getStyle element 'font size'..
Retrieving percentage CSS values (in firefox) http://stackoverflow.com/questions/8387419/retrieving-percentage-css-values-in-firefox steweb RaVyU var left '#box' .css 'left' or by plain js demo http jsfiddle.net steweb tUAKA function getStyle el styleProp from ppk's quirksmode var x document.getElementById el if x.currentStyle var y x.currentStyle styleProp else if window.getComputedStyle.. getStyle el styleProp from ppk's quirksmode var x document.getElementById el if x.currentStyle var y x.currentStyle styleProp else if window.getComputedStyle var y document.defaultView.getComputedStyle x null .getPropertyValue styleProp return y.. styleProp else if window.getComputedStyle var y document.defaultView.getComputedStyle x null .getPropertyValue styleProp return y var left getStyle 'box' 'left' But if you try it on firefox 8.0.1 you'll see that the result is not correct should..
|