Adds logic to toggle the clicked class