检查https://www.belkita.com的首页。如果您缓慢向下滚动,您可以检查如何在某个点它变得跳跃和丑陋,而当它应该平滑过渡到较小的标题时。
我使用的 javascript 代码是:
<script>
// When the user scrolls down 50px from the top of the document, resize the header's font size
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 50 || document.documentElement.scrollTop > 50) {
document.getElementById("header-sidebar").style.display = "none";
document.getElementById("masthead").style.height = "80px";
document.getElementsByClassName("custom-logo")[0].style.maxWidth = "130px";
} else {
document.getElementById("header-sidebar").style.display = "block";
document.getElementById("masthead").style.height = "140px";
document.getElementsByClassName("custom-logo")[0].style.maxWidth = "230px";
}
}
</script>
慕沐林林
人到中年有点甜
神不在的星期二
随时随地看视频慕课网APP
相关分类