所以我有一個頁面顯示 100 個專案的串列。我如何能夠在 URL 中存盤滾動到的專案,以便用戶可以控制在 URL 中滾動到哪個專案?
www.site.com/inventory?scroll_position=67
uj5u.com熱心網友回復:
在您希望滾動到的文本中包含一個標簽:
<a name="scroll_position=67"></a>
該網址需要閱讀: www.myawesomesite.com/inventory#67
當頁面加載時運行以下 javascript:
function scrollTo(hash)
{
location.hash='#' hash;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/352817.html
標籤:javascript html css
上一篇:如何在我的頁面中間對我的HTML輸入進行排序/格式化,并將它們的標題排成一行?
下一篇:Django下載回傳
