error in fix the position of navigation when scroll the page
<p>I wanna to fix the position of navigation at the top when the navigation position and scroll position are equal. Please let me know how can I get the position of navigation and page scroll position? I wanna like this site page <a href="http://new.livestream.com/live-video-tools" rel="nofollow">http://new.livestream.com/live-video-tools</a>
I'm using the following script</p>

<pre><code>                 &lt;script language="javascript"&gt;
                      $(function() {

              // grab the initial top offset of the navigation 
             var sticky_navigation_offset_top = $('#main-heading').offset().top;

           // our function that decides weather the navigation bar should have "fixed" cs s position or not.
                 var sticky_navigation = function(){
           var scroll_top = $(window).scrollTop(); // our current vertical position from the top
         // if we've scrolled more than the navigation, change its position to fixed to stick to top,
       // otherwise change it back to relative
       if(scroll_top &gt; sticky_navigation_offset_top) { 
         $('#fixed_nav').css({ 'position': 'fixed', 'top':6, 'left':0, 'width':'100%', 'z-index':999, 'height':80,  'background':'#fff' });
      } else {
         $('#fixed_nav').css({ 'position': '','overflow': 'visible', 'display':'block','height':80}); 
    } 
                                                                                                      };
     // run our function on load
       sticky_navigation();

   // and run it again every time you scroll
     $(window).scroll(function() {
     sticky_navigation();
   });
</code></pre>

<p>});
</p>
