Given a smooth projective variety X with a smooth nef divisor D and a positive integer r, we construct an I-function, an explicit slice of Givental's Lagrangian cone, for Gromov--Witten theory of the root stack X_{D,r}. As an application, we also obtain an I-function for relative Gromov--Witten theory following the relation between relative and orbifold Gromov--Witten invariants.