added javascript for smoother transition