Merge new javscript with directive. Maybe consider converting to more angular ways of doing the animation etc