Particle acceleration by electrostatic waves traveling perpendicular to nonuniform magnetic fields