Stop jQuery Typewriter animation onclick
<p>I'm wondering how I might stop the following typewriter script when I - for instance - click a link. I don't want to do anything fancy, simply stop the animation as soon as the link is clicked.</p>

<pre><code>$(function () {
var ch = 0;
var item = 0;
var items = $('.headline_origin li').length;
var time = 1000;
var delay = 40;
var wait = 6000;
var tagOpen = false;

function tickInterval() {
    if(item &lt; items) {
        var text = $('.headline_origin li:eq('+item+')').html();
        type(text);
        text = null;
        var tick = setTimeout(tickInterval, time);
    } else {
        clearTimeout(tick);
    }
}

function type(text) {
    time = delay;
    ch++;
    if(text.substr((ch - 1), 1) == '&lt;') {
        if(text.substr(ch, 1) == '/') {
            tagOpen = false;
        }
        var tag = '';
        while(text.substr((ch - 1), 1) != '&gt;') {
            tag += text.substr((ch - 1), 1);
            ch++;
        }
        ch++;
        tag += '&gt;';
        var html = /\&lt;[a-z]+/i.exec(tag);
        if(html !== null) {
            html = html[0].replace('&lt;', '&lt;/') + '&gt;';
            tagOpen = html;
        }
    }
    if(tagOpen !== false) {
        var t = text.substr(0, ch);
    } else {
        var t = text.substr(0, ch);
    }

    $('h1 span.origin').html(t);
    if(ch &gt; text.length) {
        item++;
        ch = 0;
        time = wait;
    }
}

var tick = setTimeout(tickInterval, time);
});
</code></pre>

<p>Thanks in advance!</p>

<p>@rrfive</p>
