add z-index; consolidate positionElement and resizeElement