Search

7/27/2009

PixelToEm

http://github.com/davglass/yui-tools/blob/5ae0ed588feef376f10fa91dd5a2e9154cd12484/tools.js


/**
* @method PixelToEm
* @description Divide your desired pixel width by 13 to find em width. Multiply that value by 0.9759 for IE via *width.
* @param {Integer} size The pixel size to convert to em.
* @return Object of sizes (2) {msie: size, other: size }
* @type Object
*/
PixelToEm: function(size) {
var data = {};
var sSize = (size / 13);
data.other = (Math.round(sSize * 100) / 100);
data.msie = (Math.round((sSize * 0.9759) * 100) / 100);
return data;
},

沒有留言: