2011-04-05 130 views
1

我有一個浮動菜單插件我正在爲jQuery工作,它讓我瘋狂,因爲它在其他瀏覽器中可以正常工作,但是在Chrome中它只是坐在那裏而不是滾動頁面,當用戶向上或向下滾動:jQuery浮動菜單不適用於Chrome

   // Cache :) 
      var fblb_cont = $("#fblb_cont"); 
      var fblb_main = $("#fblb_cont .fblb_main"); 
      var fblb_pos = $('#fblb_cont').position().top; 
      var float_easing = "easeOutQuint"; 

      // When the user scrolls 
      $(window).scroll(function() { 


       // Float our bar to correct page location 
       // Figure out how much to scroll 
       var scroll_factor = $(document).scrollTop(); 

       // Create our new scrollTo position    
       var newPos = (fblb_pos + scroll_factor); 

       // Check if the window height is within bounds 
       if($(window).height() < $("#fblb_cont").height()+$("#fblb_cont .fblb_main").height()){ 

        // Adjust where needed 
        fblb_cont.css("top", fblb_pos); 

       } else { 

        // Otherwise animate our scroll to the new position 
        $("#fblb_cont").stop().animate({top: newPos}, defaults.float_speed, float_easing); 

       } // End if 



      }); // End on scroll 

回答

0

試試這個:

$("#fblb_cont").stop().animate({top: newPos + 'px'}, 
          defaults.float_speed, float_easing); 
相關問題