87,839
社区成员




<style type="text/css">
#div1{
width:200px;
height:200px;
border:2px red solid;
position:fixed;
bottom:0;
right:0;
}
</style>
<script src="//code.jquery.com/jquery-1.9.1.min.js"></script><div id="_a" style="position: fixed;top:50%;right: 0px;background: #333;width: 100px;height: 100px;margin-top:-50px;">
内容放这里
</div>
<script>
$(function(){
if(!(/MSIE [56]/g.test(navigator.appVersion) || (/MSIE [789]/g.test(navigator.appVersion) && (document.compatMode == "BackCompat"))))return;
var v=$('#_a').css({ "position":"absolute"});
function f(){
var d = {};
var b= document.compatMode == "BackCompat";
var cw=b?document.body.clientWidth:document.documentElement.clientWidth;
var ch=b?document.body.clientHeight: document.documentElement.clientHeight;
var sl=document.documentElement.scrollLeft || document.body.scrollLeft;
var st=document.documentElement.scrollTop || document.body.scrollTop;
d.left = (sl + cw -v.width()) + "px";
d.top = (st +( ch -v.height())/2) + "px";
v.css(d)
}
$(window).resize(f).scroll(f);f();
})
</script>
<div style="width:1px;height:3000px;background:red;">
<!---end
楼上给的代码~我只是贴过来而已