avatar animation code only executed on appropriate page