edited js for animation