Created
October 14, 2013 12:50
-
-
Save lutzissler/6975084 to your computer and use it in GitHub Desktop.
jQuery realWidth plugin. Returns the real (sub-pixel, non-rounded) width of an element as stored internally in the browser. Thanks to ssorallen for the hint. See http://stackoverflow.com/questions/3603065/do-not-round-width-in-jquery#16072668 for context.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
$.fn.realWidth = function () { | |
var els = $(this); | |
return els.length ? els[0].getBoundingClientRect().width : null; | |
} | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment