	window.addEventListener('scroll', function() {
				var navbar = document.querySelector('#nav');
				var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
				var navbarHeight = navbar.offsetHeight;
				var maxScroll = 2 * navbarHeight; // 根据需要调整参数
				var scrollPosition = scrollTop / maxScroll;

				if (scrollPosition <= 1) {
					navbar.style.backgroundColor = 'rgba(255, 255, 255,0.6 ' + scrollPosition + ')';
					navbar.querySelectorAll('li a').forEach(function(element) {
						element.style.color = 'rgba(0, 0, 0, ' + scrollPosition + ')';
					});
				} else {
					navbar.style.backgroundColor = 'rgba(255, 255, 255, 1)';
					navbar.querySelectorAll('li a').forEach(function(element) {
						element.style.color = 'rgba(0, 0, 0, 1)';
					});
				}

				// 返回到最顶部时恢复初始颜色
				if (scrollTop === 0) {
					navbar.style.backgroundColor = 'transparent';
					navbar.querySelectorAll('li a').forEach(function(element) {
						element.style.color = '#fff';
					});
				}
			});