Works for google chrome but not for firefox and IE
<p>does anyone know why this works on chrome only. it is basically a code that snaps the nav-bar into the top when you scroll down by the nav-fixed class. and the function fix_top_bar is a way to center the bar that is created. </p>

<pre><code>function fix_top_bar(){
    var barWidth = $('.nav-fixed').width();
    $('.nav-fixed').css({ 'left' : '50%', 'margin-left' : '-' + (barWidth/2 + 20) + 'px' });
}

$('document').ready(function() {
        $(window).scroll(function() {
            if ($('body').scrollTop() &gt; 112) {

                $('nav').addClass('nav-fixed');
                fix_top_bar();                              
                }else{
                $('.nav-fixed').css({ 'left' : '', 'margin-left' : ''});
                $('nav').removeClass('nav-fixed');
            }
        });

    fix_top_bar();
    $(window).resize(function(){
          fix_top_bar();  
    });
    });
</code></pre>
