三種方法實現頁面滾動條直接滾動到頂部

1.document.body.scrollTop=document.documentElement.scrollTop=0 //頁面滾動到頂部 2.document.body.scrollIntoView() 3.document.getElementById('site-nav').scrollIntoView() 下面是一個小的例子: // 每次切換標題欄都從第一個開始展現
相關文章
相關標籤/搜索