How do I tell IE to add the class 'Selected' to my LI on scroll?
<p>I was hoping to get a little help with my code. This works in moz/webkit but not in ie. I don't quite understand why :(</p>

<pre><code>$(window).trigger('hashchange');

// Add .selected class to nav on page scroll
var $sections = $('section');  
var $navs = $('nav &gt; ul &gt; li');
var topsArray = $sections.map(function() {
    return $(this).position().top - 50;  
}).get();                              
var len = topsArray.length;  
var currentIndex = 0;        
var getCurrent = function( top ) {   
    for( var i = 0; i &lt; len; i++ ) {   
        if( top &gt; topsArray[i] &amp;&amp; topsArray[i+1] &amp;&amp; top &lt; topsArray[i+1] ) {
            return i;

        }
    }
};

$(document).scroll(function(e) {
    var scrollTop = $(this).scrollTop();
    var secondSection = topsArray[1];

    if(scrollTop &lt;= 200) { // moved past the header
        $navs.eq(0).removeClass("selected")
    } else if(scrollTop &gt;= 205 &amp;&amp; scrollTop &lt;= secondSection ) { // between header and 2nd section
        $navs.eq(0).addClass("selected")
    } 
    var checkIndex = getCurrent( scrollTop );
        if( checkIndex !== currentIndex ) {
            currentIndex = checkIndex;
            $navs.eq( currentIndex ).addClass("selected").siblings(".selected").removeClass("selected");
    }

});
</code></pre>
