<script>
var box = document.getElementById('box');
//获取内联样式的属性top
var sheet = document.styleSheets[0];
var rules = sheet.cssRules || sheet.rules;
var rule = rules[1];
window.onscroll = function(){
//框框距离顶端的距离
var distance = box.offsetTop;
//获取滚动条距离顶部的位置
var sTop = document.body.scrollTop || document.documentElement.scrollTop || window.pageYOffset;
rule.style.top = parseInt(sTop)+parseInt(distance)+'px';
}
</script>
登陆异常
相关分类