//尾部导航栏更多页面内的时间。 var t = null; t = setTimeout(time, 1000); function time(){ clearTimeout(t); dt = new Date(); var y = dt.getYear() + 1900; var mm = dt.getMonth() + 1; var d = dt.getDate(); var weekday = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]; var day = dt.getDay(); var h = dt.getHours(); var m = dt.getMinutes(); var s = dt.getSeconds(); if (h < 10) { h = "0" + h; } if (m < 10) { m = "0" + m; } if (s < 10) { s = "0" + s; } document.getElementById("time_date").innerHTML = y + "年" + mm + "月" + d + "日"; document.getElementById("time_w").innerHTML = weekday[day]; document.getElementById("time_hm").innerHTML = h + ":" + m; document.getElementById("time_s").innerHTML = s; t = setTimeout(time, 1000); } //如果需要尾部导航栏固定,把下面代码全部删除即可。 var new1_scroll_position = 0; var last1_scroll_position; var footer = document.getElementById("footer_nav"); window.addEventListener('scroll', function(e) { last1_scroll_position = window.scrollY; // 向下滚动 if (new1_scroll_position < last1_scroll_position && last1_scroll_position > 2) { footer.classList.remove("slideDown"); footer.classList.add("slideUp1"); // 向上滚动 } else if (new1_scroll_position > last1_scroll_position) { footer.classList.remove("slideUp1"); footer.classList.add("slideDown"); } new1_scroll_position = last1_scroll_position; });