I need to do a numeric calculation based on CSS properties. However, when I use this to get info:
$(this).css(\'marginBottom\')
it returns
I use a simple jQuery plugin to return the numeric value of any single CSS property.
It applies parseFloat to the value returned by jQuery's default css method.
Plugin Definition:
$.fn.cssNum = function(){
return parseFloat($.fn.css.apply(this,arguments));
}
Usage:
var element = $('.selector-class');
var numericWidth = element.cssNum('width') * 10 + 'px';
element.css('width', numericWidth);