jquery的兼容性一般都很好啊  

解决方案 »

  1.   

    IE你想用这么两行代码做到这个效果,那是不可能的。IE做的浮动效果,实际上是两个div的叠加,下面一个div是半透明的,把可以操作的遮住,上面的div正常显示,看上去就象浮动效果。
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.1.min.js"></script>
    <script type="text/javascript">
        (function ($) {
            $.fn.floatAutoScroll = function () {
                this.each(function () {
                    var obj = $(this);
                    var top = obj.css('top').replace('px', '');
                    $(window).scroll(function () {
                        var scrollTop = $(window).scrollTop();
                        obj.stop().animate({ top: (top * 1 + scrollTop * 1) }, 'normal');
                    });
                });
            }
        })(jQuery);
        $(function () {
            $('.float-container').floatAutoScroll();
        });
    </script>
    <style type="text/css">
    .main { height:1500px; }
    .float-container { position:absolute; right:0; width:50px; height:50px; background-color:#960; }
    .float1 { top:100px; }
    </style>
    </head>
            
    <body>
    <div class="main"></div>
    <div class="float-container float1">浮动框1</div>
    </body>
    </html>一个标签搞定
      

  3.   


    var scrollTop = document.documentElement.scrollTop + document.body.scrollTop;
      

  4.   


    你就是少了这个标签,不信你去掉这个标签然后试试,IE对<!DOCTYPE 比较敏感,根据有无<!DOCTYPE标签,获取高度的方法也不一样 
      

  5.   

    http://zhidao.baidu.com/link?url=S6NrMAcCUM4JC6GrqmQpYAP4MlrLve7utc6yH2MZioaQiUUg-OcGJNn-XNKormzIcxl0DxlN7Q6Vnyc4rCmeU_这个应该可以说明