我有这种图像在我的网站,在举4和想像是在我的用户的屏幕时的某些按钮或图像是点击的通过加入空白的底部的网站因此图像是在屏幕上当我的网站是滚动的所有方式下(我已经想通了与JS功能)。 怎么可以不断增加空白的网站,直到的图像上屏幕上? 我已经想出了一个解决方案具有某些元素在CSS与利润的固定测量和有时可见的点击,但是希望它可以对各种大小的视.
scrollingElement = (document.scrollingElement || document.body);
function scrollSmoothToBottom (id) {
$(scrollingElement).animate({
scrollTop: document.body.scrollHeight
}, 500);
}
window.onload = function(){
// Make WhiteSpace not on website
document.getElementById("whiteSpace").style.display = "none";
document.getElementById("submitButton").addEventListener("click",function(){
// Once Button is clicked make whitespace visible then scroll to bottom
document.getElementById("whiteSpace").style.display = "block";
scrollSmoothToBottom ();
});
}
.space{
margin:520px;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<center>
<h1 id = "collegeNameTitle">Name</h1>
<h3>Student Size</h3>
<span class="badge badge-success even-larger-badge" id = "collegeStudentSizeText">10</span>
<h3>Acceptance Rate:</h3>
<span class="badge badge-success even-larger-badge" id = "collegeAcceptanceRateText">10</span>
<h3>Student-Faculty Ratio:</h3><span class="badge badge-success even-larger-badge" id = "collegeRatioText">10</span>
</center>
<center><button id = "submitButton"><img class = "collegeImage"src="sample.png" id = "collegeImage"></button></center>
<div id = "whiteSpace" class ="space" visibility = "hidden">
</div>
如何我想我的网站。 这是我的代码现在想要它如此,在CSS我没有固定测量的空间,但直到的图像到达顶端。