Function for creating pop-ups via CSS transitions and JavaScript