<textarea rows="8" id="CodeText83280" class="UBBText"><!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> |
<style type="text/css"> |
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td,hr,button,article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section { |
margin:0; |
padding:0; |
} |
.float { |
background-color: #FFFEE0; |
border: 1px solid #FFECB0; |
box-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2); |
padding: 10px; |
position: absolute; |
right: 10%; |
top:134px; |
width: 80px; |
} |
</style> |
</head> |
<body style="height:3000px;"> |
<div class="float" id="float">1c城市城</div> |
</div> |
<script type="text/javascript"> |
window.onscroll = function (){ |
setInterval(scrol,30); |
} |
function scrol(){ |
var oFd = document.getElementById( 'float' ); |
var top = oFd.style.top; |
var scrollTop = document.documentElement.scrollTop||document.body.scrollTop; |
if (scrollTop > 134){ |
oFd.style.position = 'fixed' ; |
oFd.style.top = '0' ; |
} else { |
oFd.style.position = 'absolute' ; |
oFd.style.top = '134px' ; |
} |
} |
</script> |
</body> |
</html> |