# Plotly Animation Auto Loop

**URL:** <https://community.plotly.com/t/plotly-animation-auto-loop/10096>\
**Category:** plotly.js\
**Created:** [May 4, 2018, 7:53pm UTC](https://community.plotly.com/t/plotly-animation-auto-loop/10096 "2018-05-04T19:53:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![buen0011](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@buen0011](https://community.plotly.com/u/buen0011)\
**Post date:** [May 4, 2018, 7:53pm UTC](https://community.plotly.com/t/plotly-animation-auto-loop/10096/1 "2018-05-04T19:53:50Z")

</div>

Hi,

I am trying to create an auto-loop functionality for the animation slider.

To achieve this, I need to know when the slider reaches the end so that I can add an auto-click functionality to the play button.

Is there anyway I can detect when the slider reaches the end or return the slider value dynamically?

Thank you

---

<div class="post-metadata">

**Author:** ![buen0011](https://avatars.discourse-cdn.com/v4/letter/b/cdc98d/32.png) [@buen0011](https://community.plotly.com/u/buen0011)\
**Post date:** [May 7, 2018, 3:24pm UTC](https://community.plotly.com/t/plotly-animation-auto-loop/10096/2 "2018-05-07T15:24:16Z")

</div>

Found the answer! 🙂

Here’s the code if anyone is interested in using it 🙂

myPlot.on(‘plotly\_sliderchange’, function(e){  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;console.log(e.step.label);  
}
