外站合作区
澳彩独家高手出版精料
澳彩2022年综合资料大全
澳彩资料独家精准四肖
外站合作区
// 顶部切换
window.onscroll = function () {
var topScroll = get_scrollTop_of_body(); //滚动的距离,距离顶部的距离
var am_nav = document.getElementById("am_nav"); //获取到导航栏id
if (topScroll > 250) { //当滚动距离大于250px时执行下面的东西
am_nav.style.position = 'fixed';
am_nav.style.top = '0';
am_nav.style.zIndex = '9999';
am_nav.style.maxWidth = '800px';
} else { //当滚动距离小于250的时候执行下面的内容,也就是让导航栏恢复原状
am_nav.style.position = 'static';
}
};
function get_scrollTop_of_body() {
var scrollTop;
if (typeof window.pageYOffset != 'undefined') { //pageYOffset指的是滚动条顶部到网页顶部的距离
scrollTop = window.pageYOffset;
} else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
scrollTop = document.documentElement.scrollTop;
} else if (typeof document.body != 'undefined') {
scrollTop = document.body.scrollTop;
}
return scrollTop;
};
// 帖子切换
function setTabtt(name, cursel, n) {
for (i = 1; i <= n; i++) {
var menu = document.getElementById(name + i);
var con = document.getElementById('con_' + name + '_' + i);
menu.className = i == cursel ? 'hover' : '';
con.style.display = i == cursel ? 'block' : 'none';
}
}