链接到另一个页面上的锚标记不起作用

pee*_*pee 2 html wordpress

我有一个 wordpress 网站(不向公众开放)。我有一个菜单,在该菜单中,我有一个链接,例如http://example.org/schedule/#x-content-band-1

现在,当我点击它时,什么也没有发生。浏览器底部的状态栏显示该 URL(这是正确的),但单击它什么也不做。但是,如果我右键单击并打开一个新选项卡/窗口,那么它打开页面就好了

关联

<a href="http://example.org/schedule/#x-content-band-1"><span>Speakers</span></a>
Run Code Online (Sandbox Code Playgroud)

<div id="x-content-band-1">...</div>
Run Code Online (Sandbox Code Playgroud)

ish*_*ood 5

如果您有多个相似的 ID,连字符可能会很麻烦。浏览器倾向于将带连字符的 URL 组件视为单独的单词,因此您可能有几个看起来相同的。

尝试使用下划线或驼峰命名,或确保第一个连字符之前的子字符串是唯一的。