Despite a tremendous success in the optical manipulation of microscopic particles, it remains a challenge to manipulate nanoparticles especially as the polarizability of the particles is small. With a picosecond-pulsed near-infrared laser, we demonstrated recently that the confinement of dye-doped polystyrene nanobeads is significantly enhanced relative to bare nanobeads of the same dimension. We attributed the enhancement to an additional term of the refractive index, which results from two-photon resonance between the dopant and the optical field. The optical confinement is profoundly enhanced as the half-wavelength of the laser falls either on the red side, or slightly away from the blue side, of the absorption band of the dopant. In contrast, the ability to confine the nanobeads is significantly diminished as the half-wavelength of the laser locates either at the peak, or on the blue side, of the absorption band. We suggest that the dispersively shaped polarizability of the dopant near the resonance is responsible to the distinctive spectral dependence of the optical confinement of nanobeads. This work advances our understanding of the underlying mechanism of the enhanced optical confinement of doped nanoparticles with a near-infrared pulsed laser, and might facilitate future research that benefits from effective sorting of selected nanoparticles beyond the limitations of previous approaches.