diff --git a/libs/jquery.pxToEm/pxem.jQuery.js b/libs/jquery.pxToEm/pxem.jQuery.js index abc1737a5..2bf8af187 100755 --- a/libs/jquery.pxToEm/pxem.jQuery.js +++ b/libs/jquery.pxToEm/pxem.jQuery.js @@ -8,26 +8,27 @@ scope: string or jQuery selector for font-size scoping * Usage Example: $(myPixelValue).toEm(); or $(myEmValue).toPx(); --------------------------------------------------------------------*/ +(function($) { + $.fn.toEm = function(settings){ + settings = jQuery.extend({ + scope: 'body' + }, settings); + var that = parseInt(this[0],10), + scopeTest = jQuery('
 
').appendTo(settings.scope), + scopeVal = scopeTest.height(); + scopeTest.remove(); + return (that / scopeVal).toFixed(8) + 'em'; + }; -$.fn.toEm = function(settings){ - settings = jQuery.extend({ - scope: 'body' - }, settings); - var that = parseInt(this[0],10), - scopeTest = jQuery('
 
').appendTo(settings.scope), - scopeVal = scopeTest.height(); - scopeTest.remove(); - return (that / scopeVal).toFixed(8) + 'em'; -}; - -$.fn.toPx = function(settings){ - settings = jQuery.extend({ - scope: 'body' - }, settings); - var that = parseFloat(this[0]), - scopeTest = jQuery('
 
').appendTo(settings.scope), - scopeVal = scopeTest.height(); - scopeTest.remove(); - return Math.round(that * scopeVal) + 'px'; -}; + $.fn.toPx = function(settings){ + settings = jQuery.extend({ + scope: 'body' + }, settings); + var that = parseFloat(this[0]), + scopeTest = jQuery('
 
').appendTo(settings.scope), + scopeVal = scopeTest.height(); + scopeTest.remove(); + return Math.round(that * scopeVal) + 'px'; + }; +})(jQuery); \ No newline at end of file