日期:2014-05-17  浏览次数:20464 次

IE下没反应
<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>
下拉条浮动效果,火狐可以,IE不行,大神帮看看

------解决方案--------------------
jquery的兼容性一般都很好啊  
------解决方案--------------------
IE你想用这么两行代码做到这个效果,那是不可能的。

IE做的浮动效果,实际上是两个div的叠加,下面一个div是半透明的,把可以操作的遮住,上面的div正常显示,看上去就象浮动效果。
------解决方案--------------------
ie11可以,你用的ie几?
------解决方案--------------------
4楼的可行  学习啦
------解决方案--------------------
用CSS 不行么<