apply a first and last class to the popup