簡體   English   中英

錨標簽頁跳轉

[英]Anchor tag page jump

這應該很簡單:我的頁面上有一堆命名錨標簽。 這些標簽從網站上的其他頁面鏈接到。 但是由於某種原因,當我鏈接到page#anchor時,它總是跳回到頂部。 例如:

http://thedenvillehub.com/test-hs/services.asp#firesetter

它會轉到正確的區域,然后跳到頂部。

如果您單擊鏈接進行訪問,也會發生同樣的事情:

http://thedenvillehub.com/test-hs/troubled.asp (單擊“少年射擊手計划”)

有任何想法嗎? 它可以在IE中正常運行,但不能在FF或Chrome中運行。

您有導致此的內聯JS:

<script type="text/javascript">
// When ready...
window.addEventListener("load",function() {
    // Set a timeout...
    setTimeout(function(){
        // Hide the address bar!
        window.scrollTo(0, 1);
    }, 0);
});
</script>

這是由以下JavaScript引起的:

// When ready...
window.addEventListener("load",function() {
    // Set a timeout...
    setTimeout(function(){
        // Hide the address bar!
        window.scrollTo(0, 1);
    }, 0);
});

刪除此腳本應該可以解決您的問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM