日期:2014-05-17 浏览次数:20502 次
<html xmlns="http://www.w3.org/1999/xhtml">下拉条浮动效果,火狐可以,IE不行,大神帮看看
<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>