简体   繁体   English

如何摆脱子菜单工具提示?

[英]How to get rid of submenu tooltips?

When hovering over an menu item with submenu pages in the wordpress backend a "tooltip" showing each submenu page is popping up. 将鼠标悬停在wordpress后端具有子菜单页面的菜单项上时,会弹出一个“工具提示”,显示每个子菜单页面。

How can I get rid of these? 我该如何摆脱这些?

在此处输入图片说明

What I've tried so far: Removing the wp-has-submenu style class. 到目前为止,我已经尝试过:删除wp-has-submenu样式类。 This works - kinda. 这有效-有点。 When hovering the tooltip doesnt appear anymore. 悬停时,工具提示不再显示。 On mousedown on an item the tooltip still appears. 在将鼠标悬停在某个项目上时,工具提示仍会出现。

    $('#adminmenu').children('li').each(function () {
        $(this).removeClass('wp-has-submenu');
    // removing or changing the value of the 'aria-haspopup' attr doesn't solve the problem. Not sure what the attr is for
    //  $(this).children('a').each(function(){
    //      $(this).attr('aria-haspopup', 'false');
    //  });
    });

Update1 更新1

Well okay this seems to be pure javascript and no jQuery. 好吧,这似乎是纯JavaScript而不是jQuery。 I've removed any event bindings from any element. 我已经从任何元素中删除了任何事件绑定。 Still showing tooltips. 仍显示工具提示。

    $('html').find("*").each(function () {
        $(this).off();
        $(this).unbind();
    });

AFAIK and a short google you can't remove pure js event handlers without a reference to the actual handler. AFAIK和一个简短的google,如果没有对实际处理程序的引用,就无法删除纯js事件处理程序。

Update2 更新2

Hmm looking through /wp-admin/js/ it seems everything or at least very much is done in jQuery.. So.. I'm running out of ideas 嗯,通过/wp-admin/js/ ,似乎所有事情或至少很多事情都是在jQuery中完成的。。。。。

Update3 更新3

After searching/looking and editing a lot of .js files I decided to delete /wp-admin/js and /wp-includes/js . 在搜索/查找和编辑许多.js文件之后,我决定删除/wp-admin/js/wp-includes/js IT IS STILL APPEARING. 它仍然出现。 Holy .. what the heck are they doin. 神圣..他们到底在干什么。

Update 4 更新4

This seems to work 这似乎有效

.js #adminmenu .opensub .wp-submenu {
    display:none !important;
}


Yes,your code is working now. 是的,您的代码正在运行。 But I 'm describing here a simple way for adding this code in our theme and it will remove the hover effect in admin section. 但是我在这里描述了一种在主题中添加此代码的简单方法,它将删除admin部分中的悬停效果。
Follow the steps. 按照步骤。

Step-1: add this code in functions.php file of your theme.
function theme_name_scripts() { wp_enqueue_style( 'admin-hovermenu', get_template_directory_uri() ."/admin.css" ); }add_action( 'admin_enqueue_scripts', 'theme_name_scripts' );
Step:2 Create a file named admin.css and add this line in that file.
.js #adminmenu .opensub .wp-submenu { display:none !important; }
Now it will works.If need anything else then please let me know. 现在就可以了。如果需要其他任何功能,请告诉我。

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

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