I have jquery accorion id #accordion
and some of the content inside header class name .simpleColor
. Now I want to give a calculated margin to .simp
I believe the CSS should be pure style definition. I dont like to mix some calculations with that. I would do that in my javascript
var accWidth=parseInt($("#accordion").css("width").replace("px",""));
var simpWidth=parseInt($(".simpleColor").css("width").replace("px",""));
var marginLeft=((accWidth/2)-(simpWidth/2));
$(".simpleClass").css("margin-left",marginLeft);
Working sample http://jsfiddle.net/mzTRw/19/