简体   繁体   English

锚标签页跳转

[英]Anchor tag page jump

This should be a simple one: I have a page with a bunch of named anchor tags. 这应该很简单:我的页面上有一堆命名锚标签。 These tags are linked to from various other pages on the site. 这些标签从网站上的其他页面链接到。 But for some reason, when I link to the page#anchor, it always jumps back to the top. 但是由于某种原因,当我链接到page#anchor时,它总是跳回到顶部。 For example: 例如:

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

It goes to the correct area, but then jumps to the top. 它会转到正确的区域,然后跳到顶部。

Same thing happens if you click on a link to get to it: 如果您单击链接进行访问,也会发生同样的事情:

http://thedenvillehub.com/test-hs/troubled.asp (click on "Juvenile Firesetter Program") http://thedenvillehub.com/test-hs/troubled.asp (单击“少年射击手计划”)

Any ideas? 有任何想法吗? It works correctly in IE, but not FF or Chrome. 它可以在IE中正常运行,但不能在FF或Chrome中运行。

You have in-line JS that's causing this: 您有导致此的内联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>

This is caused by the following JavaScript: 这是由以下JavaScript引起的:

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

Removing this script should solve your issue. 删除此脚本应该可以解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM