[英]Load Additional Data While scrolling down a page using jQuery Ajax and ASP.NET
[英]Automatically page scrolling down in asp.net
打開asp.net頁面時出現問題。 發布后,我的頁面滾動到頁面中間。 頁面包含一個ModalPopupExtender和許多JavaScript。 我認為頁面加載時頁面將重點放在此ajax控件上。 沒有與“動畫”或“滾動”相關的javascript函數來滾動頁面。我嘗試了以下代碼進行修復
$(document).ready(function() {
document.getElementById('staticcontrols').scrollIntoView(false);
});"
在mozilla FX中,它可以工作,但在IE中則不能。 請幫我。
提前致謝。
//JQUERY library needed
//SOURCE
<script type="text/javascript" src="../Styles/Cjs/jquery-1.6.4.min.js"></script>
<script type="text/javascript">
function main() {
$('html, body').animate({ scrollTop: 340 }, 'slow');
};
</script>
//C#
page_load
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "<script type='text/javascript'>main();</script>", false);
}
//JQUERY library
https://jquery.com/download/
試試這個代碼
<script type="text/javascript">
scroll(0, 0);
</script>
發生回發時,它將在最頂角滾動您的頁面。
希望對您有幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.