js固定页面底部悬浮框特效代码

<html>
<head>
<style type="text/css">
.tt {

border: 1px #F00 solid;
background-color:#0F0;
width: 80px;
height: 80px;
display:block;

position:absolute;
right:0px;
bottom: 0px;
}
</style>
<script language="javascript">
function relocate(){
var mydiv = document.getElementById("myDiv");
var height = Math.abs(document.body.clientHeight + document.body.scrollTop - 80);
window.status = document.body.clientHeight + " " + document.body.scrollTop;
mydiv.style.top = height;
}
</script>

</head>
<body style="padding:0px;margin:0px;height:100%" >
   <script language="javascript">
window.onscroll = relocate;
window.onresize = relocate;
</script>

<div id="myDiv" class="tt">
This is a test one
</div>




</body>
</html>
 

你可能感兴趣的:(js)