我正在開發移動網站。該網站主要在Opera mini和UCbrowser中查看。我已經添加滾動到頂部按鈕作爲滾動到頁面頂部,無需刷新/重新加載該頁面
<input type="button" name="scroll to top" onclick="scroll(0,0)"/>
但這點擊它重新加載,然後到頂部。有些時候,它不工作..
的細節去的Opera Mini及UC瀏覽器中的Opera Mini
視圖m.facebook.com他們增加[↑]頂到feinix.org/mevents.php 。如果有人張貼在我身後說
嘗試'window.scrollTo(0,0這將是巨大的);'[我如何使用jQuery滾動到頁面頂部?](http://stackoverflow.com/questions/1144805/how-do-i-scroll-to-the-top-of-the-page -with-jquery) – Satpal
嘗試'$(selector).scrollTop(0)' – Stiger
嘗試在scr之前設置preventDefault OLL(0,0)。像這樣:'document.querySelector(「」).addEventListener(「click」,function(e){e.preventDefault(); window.scroll(0,0);});' –
mqchen