Remove elements in and out of DOM based on visibility