improve the replacement of calc with jquery