我想獲得一個div,刷新每2秒停止滾動回2秒刷新後我有PHP代碼和JavaScript。我使用的JavaScript是:div滾動到頂部刷新後需要停止自動滾動到頂部
function at_Ticket_scrollBottom()
{
var objDiv = document.getElementById("cartTicket");
objDiv.scrollTop = objDiv.scrollHeight;
}
function at_Tabs_Update()
{
if(div_WPOSVar_IsVisible())
{
//calling setTimeout without clearing any existing timeout can add multiple calls.
//IE the normal 2 second sequence, then call at_Tabs_Update two more times, and
// now we have 3 timeouts set to call at_Tabs again, etc.
//This wouldn't be an issue except that we call at_Tabs_Update directly to cause
// immediate refresh from many places.
//So clear the handle everytime to get rid of the last one we set.
clearTimeout(at_Tabs_Timer);
at_Tabs_Timer=setTimeout("at_Tabs_Update()", 2*1000); //every 2 seconds
return;
}
}
所以,如果我向下滾動到它跳回一次刷新後頂部票的底部,所以我永遠不能深究,並選擇一個項目後刷新並在刷新之前進行編輯,如何停止自動滾動回到頂部。
你是如何刷新單嗎? – Alan
我已添加顯示刷新代碼的部分,請讓我知道您是否需要更多。 – Meef
這實際上並未顯示刷新過程中發生了什麼,只是顯示如何清除超時。 – invertedSpear