Question: I've written this simple Carousel. At the moment I'm using setInterval to run my nextSlide function at certain intervals. I want to defer the timer from running when a user clicks on the navigation links for a certain length of time.

Check it out here
<http://jsbin.com/uzixi3/3/edit>

Any feedback on how the rest is written would be good too.

Answer: 
You can save the return value of `setInterval` in a variable to refer to it later - that way you can cancel it if you need to, or restart it.

See [this MDC article](https://developer.mozilla.org/en/window.setInterval) for more details.

The basics are:

```
intervalID = setInterval(flashText, 1000);

//do something...

clearInterval(intervalID);

```
The above code really helped. Thanks Nick. I made a few minor adjustments so that once you clicked the function: the timer would stop, the function would execute, and then the timer initiates and resumes regular intervals.

make sure you re-assign the `var int` to the new `interval` you create within the `click function`.

```
var int = setInterval(change_slide, 5000);
$("#div").click(function() {
    console.log('clicked');
  clearInterval(int);
  setTimeout(function() {
  int = setInterval(change_slide, 5000);
  });
});

```