問題描述
我正在使用 smoothscroll.js 瀏覽我的網站.它在 Firefox 中停在正確的錨點上,但在 Chrome 中,它會在第一次單擊鏈接時通過該點,并將內容推到頂部,將內容隱藏在頁面后面.然后,如果您再次單擊它,它會正確對齊.我在其他網站上也看到了這些問題.好奇看看其他人有沒有同樣的問題.Chrome 似乎忽略了任何頂部填充或邊距或定位(例如:top:20%;).
I'm using smoothscroll.js to navigate my site. It stops on the correct anchor in Firefox, however in Chrome it passes the point on the first click of the link, and pushes the content to the top, hiding the content behind the page. then if you click it again, it aligns correctly. I've seen the problems on other sites as well. Curious to see if others have the same problem. Chrome seems to ignore any top padding or margin or positioning (example: top:20%;).
推薦答案
已解決:http://nicolasgallagher.com/jump-links-and-viewport-positioning/demo/#method-D
有幾種方法可用.
這篇關于滾動到帶有固定標題的錨點,隱藏在標題后面的內容,邊距和頂部填充不起作用的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!