Evolution of the spectral lineshape at the magnetic transition in Sr$$_2$$IrO$$_4$$ and Sr$$_3$$Ir$$_2$$O$$_7$$