Perturbation calculation of magnetic field dependence of fluxon dynamics in long inline and overlap Josephson junctions