JavaScript, Jquery find index of clicked element
<p>I building slide, and I need am stack at following problem - How can I found position (index) in the array when a tag is clicked? This part of the code is getting all a tag</p>

<pre><code> this.thumbs = this.nav.find('a');
</code></pre>

<p>How to go from there?
And also, there is another problem - I need to toggle class of the div inside a tag (when a tag is clicked div tag needs to get class promo_tumb_current and the one which has that tag need to loose it).</p>

<p>HTML code: </p>

<pre><code>&lt;div class="promo_tumbs col_12"&gt;
    &lt;div data-dir="prev" class="prev"&gt;&lt;/div&gt;
    &lt;div data-dir="next" class="next"&gt;&lt;/div&gt;
    &lt;div class="promo_tumbs_centar"&gt;
        &lt;a href="#first"&gt;&lt;div class="promo_tumb promo_tumb_current"&gt;&lt;/div&gt;&lt;/a&gt;
        &lt;a href="#second"&gt;&lt;div class="promo_tumb"&gt;&lt;/div&gt;&lt;/a&gt;
        &lt;a href="#thrid"&gt;&lt;div class="promo_tumb"&gt;&lt;/div&gt;&lt;/a&gt;
        &lt;a href="#fourh"&gt;&lt;div class="promo_tumb"&gt;&lt;/div&gt;&lt;/a&gt;
        &lt;a href="#fifth"&gt;&lt;div class="promo_tumb"&gt;&lt;/div&gt;&lt;/a&gt;
        &lt;a href="#fifth"&gt;&lt;div class="promo_tumb"&gt;&lt;/div&gt;&lt;/a&gt;
        &lt;a href="#fifth"&gt;&lt;div class="promo_tumb"&gt;&lt;/div&gt;&lt;/a&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>JS code:</p>

<pre><code>&lt;script&gt;
                function Slider(container, nav){
                    this.container = container;
                    this.nav = nav;

                    this.li = this.container.find('li');
                    this.li_width = this.li.first().width();
                    this.li_len = this.li.length;

                    this.thumbs = this.nav.find('a');

                    this.current = 0;
                }

                Slider.prototype.transition = function (coords){
                    this.container.stop().animate({
                        'margin-left' : coords || -(this.current * this.li_width)
                    })
                }

                Slider.prototype.set_current = function(dir){
                    var pos = this.current;
                    if (dir === 'next') {pos++}
                    else if (dir === 'prev') {pos--}                
                    this.current = (pos &lt; 0) ? this.li_len - 1 : pos % this.li_len;

                    return pos;
                }

                var slider = new Slider($('div.promo_inner ul'), $('div.promo_tumbs'));
                    slider.nav.find('div').on('click', function(){                               
                    if ($(this).attr("data-dir") === undefined ) {
                        var index = slider.thumbs.index();

                        console.log(index)
                    } else {
                         slider.set_current($(this).data('dir'));                    
                    }               
                    slider.transition();


                })
</code></pre>

<p></p>
