When there is a resonance in electron response, both refractive index and absorption change rapidly: the refractive index has a "jiggle" in the vicinity of the resonance, like this sketch (adapted from this earlier answer by John Rennie - but I disagree with the "n=1" label so I cut it off...:
As you can see there is higher refractive index at the low frequency end of the resonance).
At the same time, there is a peak in absorption at the resonance (since the electrons move more vigorously there is more coupling of the energy of photons with the solid).
Not all electrons have the same resonant frequency - it depends on how they are bound, and what their environment looks like. Also there is the problem that no two electrons can be in exactly the same state (Fermi exclusion) which also implies a (very) small amount of energy splitting.
More information at the following two questions:
Why does the refractive index depend on wavelength?
Why do prisms work (why is refraction frequency dependent)?