欢迎各位兄弟 发布技术文章
这里的技术是共享的
// JavaScript Document
//下面是得到滚动条到顶部的距离 function getScrollTOP() { var t; if(document.documentElement && document.documentElement.scrollTop){ t = document.documentElement.scrollTop;} else if(document.body){ t = document.body.scrollTop; } return t; } function sc5() { var t = getScrollTOP(); if(t>=800) { $('#scroll_menu').css('position','fixed'); $('#scroll_menu').css('top','0'); $('#scroll_menu').css('z-index','10'); } else { $('#scroll_menu').css('position','static'); $('#scroll_menu').css('top','auto'); $('#scroll_menu').css('z-index','auto'); } } window.onscroll = function () { sc5(); }