我有一个 图像链接到 li 元素
来自 wordpress 中的导航栏
。
一切正常,但是当我将鼠标悬停在图像上时,它还会在列表中显示悬停的菜单元素。
How can i hide that when it is linked to the image?
这是 php 代码(来自 nav-menu-template.php):
if( $args->theme_location == 'primary' )
return "<li id='menu-item-1000' class='menu-item menu-item-type-post_type menu-item-object-page menu-item-1000'><a class='logo' href='http://razvanwork.esy.es/exelo'><img style='position:absolute;top:-20px;left:-125px;z-index:200;max-width: 402%; ' src='http://razvanwork.esy.es/exelo/wp-content/uploads/2014/02/LogoPrelucrat.png' alt='Exelo' ></a></li>".$items;
我附上一张图片来展示它在做什么:
提前致谢
最佳答案
我自己搞定了,很简单。我在 href 上放了一些文本,所以它会根据导航栏菜单自行排列。之后,我将 position relative 设置为 a href,并将其向左浮动,这样我就可以将图像放在绝对位置的顶部。
这是代码:
$args->theme_location == 'primary' )
return "<li id='custom-menu-item' class='logo-menu-item'><a style='position:relative;left:-68px' class='logo' href='http://razvanwork.esy.es/exelo'>a<img style='position:absolute;top:-22px;left:-81px;z-index:200;max-width: 402%;' src='http://razvanwork.esy.es/exelo/wp-content/uploads/2014/02/LogoPrelucrat.png' alt='Exelo' ></a></li>".$items;
关于php - Wordpress - 主菜单导航的图像 href 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21797623/