一位客户报告说,当鼠标悬停在其 Wordpress 网站上时,一些链接正在打开。这只发生在 MS 浏览器上,例如 Edge(版本 14 到 18)和 IE。这个主题不是由我完成的,而是大约 1 年前由其他一些开发人员完成的,他使用 bootstrap-nav-walker 生成标题菜单,并且由它生成的所有 href 都显示了这种奇怪的行为
我在运行不同版本的 Edge 和 IE 的不同设备上进行了尝试,但问题仍然存在。将鼠标悬停在项目上时,仅触发了 bootstrap 3 方法,这在其他站点上运行得很好。客户还说这个问题发生在大约 1 1/2 年前网站启动时,并由一些 JS 代码修复,但无法告诉我到底做了什么。
这是用于生成菜单项的代码:
<div class="collapse navbar-collapse" id="navbarNav">
<?php
$bs4navwalker = new bs4navwalker();
wp_nav_menu([
'menu' => 'main',
'theme_location' => 'main',
'container' => false,
'menu_id' => false,
'menu_class' => 'navbar-nav',
'depth' => 0,
'fallback_cb' => 'bs4navwalker::fallback',
'walker' => $bs4navwalker
]);
?>
</div>
这就是结果
<ul id="menu-hauptnavigation" class="navbar-nav">
<li id="menu-item-155" class="menu-item menu-item-type-custom menu-item-object-custom menu-item-has-children menu-item-155 nav-item dropdown">
<a href="/unternehmen/erfolgsmodell-customer/" class="nav-link dropdown-toggle" data-toggle="dropdown">Unternehmen</a> <div class="dropdown-menu">
<a href="https://www.customer.ag/erfolgsmodell-customer/" class=" dropdown-item">Erfolgsmodell customer</a>
<a href="https://www.customer.ag/erfolgsmodell-systempartnerschaft/" class=" dropdown-item">Erfolgsmodell Systempartnerschaft</a>
<a href="https://www.customer.ag/systemzentrale/" class=" dropdown-item">Systemzentrale</a>
<a href="https://www.customer.ag/werte-ambitionen/" class=" dropdown-item">Werte & Ambitionen</a>
<a href="https://www.customer.ag/zahlen-fakten/" class=" dropdown-item">Zahlen & Fakten</a>
</div>
</li>
<li id="menu-item-3042" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-3042 nav-item dropdown">
<a href="https://www.customer.ag/systempartner-werden/" class="nav-link dropdown-toggle" data-toggle="dropdown">Systempartner werden</a>
<div class="dropdown-menu">
<a href="https://www.customer.ag/systempartner-werden/" class=" dropdown-item">Systempartner werden</a>
<a href="https://www.customer.ag/gruenderkategorien/gruenderstories/" class=" dropdown-item">Gründerstories</a>
<a href="https://www.customer.ag/apotheke-gruenden-2/" class=" dropdown-item">Apotheke gründen</a>
<a href="https://www.customer.ag/filialisieren/" class=" dropdown-item">Filialisieren</a>
<a href="https://www.customer.ag/umziehen-2/" class=" dropdown-item">Umbauen / Umziehen</a>
<a href="https://www.customer.ag/customermodul/" class=" dropdown-item">customer Modul</a>
</div>
</li>
<li id="menu-item-224" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-224 nav-item dropdown">
<a href="https://www.customer.ag/standort-anbieten/" class="nav-link dropdown-toggle" data-toggle="dropdown">Standort anbieten</a>
<div class="dropdown-menu">
<a href="https://www.customer.ag/standort-anbieten/" class=" dropdown-item">Standort anbieten</a>
<a href="https://www.customer.ag/standort-anbieten/fachmarktzentren/" class=" dropdown-item">Fachmarktzentren</a>
<a href="https://www.customer.ag/standort-anbieten/innenstadtlagen/" class=" dropdown-item">Innenstadtlagen</a>
<a href="https://www.customer.ag/standort-anbieten/fussgaengerzonen/" class=" dropdown-item">Fußgängerzonen</a>
<a href="https://www.customer.ag/standort-anbieten/vorkassenzonen/" class=" dropdown-item">Vorkassenzonen</a>
<a href="https://www.customer.ag/standort-anbieten/bahnhof-flughafen/" class=" dropdown-item">Bahnhöfe / Flughäfen</a>
<a href="https://www.customer.ag/standort-anbieten/shopping-malls/" class=" dropdown-item">Shopping Malls</a>
<a href="https://www.customer.ag/standort-anbieten/parkplaetze-grundstuecke-fuer-modul/" class=" dropdown-item">Parkplätze / Grundstücke für Modul</a>
</div>
</li>
<li id="menu-item-4155" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-4155 nav-item">
<a href="https://www.customer.ag/karriere/" class="nav-link">Karriere</a>
</li>
</ul>
我们也在不同的 wordpress 网站上使用 BSNavwalker,但没有一个显示出这种奇怪的行为。我也找不到任何有关 Edge 或 IE 在悬停时打开链接的帮助。