1

私は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
4

1 に答える 1

0

これを試して:

$("#fblb_cont").stop().animate({top: newPos + 'px'},
                          defaults.float_speed, float_easing);
于 2012-01-04T16:43:40.787 に答える