jquery 如何禁用谷歌翻译原始文本工具提示

vi4fp9gy  于 9个月前  发布在  jQuery
关注(0)|答案(6)|浏览(146)

我在我的网站中使用谷歌翻译作为语言转换器,但它显示了烦人的工具提示,称为“原始文本”。我如何禁用此功能和其他更好的想法/工具/API来做到这一点?
多谢。密码是...

<div id="google_translate_element"></div><script>
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: 'en'
  }, 'google_translate_element');
}
</script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

字符串

oxalkeyp

oxalkeyp1#

只需将此CSS添加到CSS文件的顶部:

.goog-tooltip {
    display: none !important;
}
.goog-tooltip:hover {
    display: none !important;
}
.goog-text-highlight {
    background-color: transparent !important;
    border: none !important; 
    box-shadow: none !important;
}

字符串
我花了8个小时来弄清楚这一点,但现在在这3行CSS之后,它看起来很棒:-)你可以在这里看到这一点:SEOgenie - Automated SEO

ncecgwcz

ncecgwcz2#

你可以做一些事情来“覆盖”你网站上的谷歌翻译显示。
我一直在利用休耕
隐藏建议框(!重要的部分真的很重要:)

#goog-gt-tt, .goog-te-balloon-frame{display: none !important;} 
.goog-text-highlight { background: none !important; box-shadow: none !important;}

字符串
为了隐藏由

.goog-logo-link{display: none !important;}
.goog-te-gadget{height: 28px !important;  overflow: hidden;}


移除顶部框架

body{ top: 0 !important;}
.goog-te-banner-frame{display: none !important;}


还有一些,但我想上面的会把你带到正确的道路上;)
向所有人问好。

nwlls2ji

nwlls2ji3#

我觉得我的方法更好^^

$(document).ready(function() 
    {       
        translationTooltipsDisable();
    });

    function translationTooltipsDisable()
    {       
        //Override google's functions
        _tipon = function()  { /*Don't display the tooltip*/ };
        _tipoff = function() { /*Don't hide the tooltip*/ };
    }

字符串

kwvwclae

kwvwclae4#

#google_translate_element {
  display:none;
}

字符串
CSS显示:没有可能工作。

ecfdbz9o

ecfdbz9o5#

看起来你可以在他们用来做“工具提示”的iframe上用一些CSS隐藏它。

.goog-te-balloon-frame { display: none; }

字符串
这可能是一个移动的目标,因为他们更新服务和更改名称/结构,但它的作品,现在对我的一个正在进行的网站。
最新消息:我注意到这个方法似乎有一个鼠标悬停/悬停的背景颜色效果,但它似乎是用JavaScript完成的(作为元素本身的样式属性添加,而不是一个类切换,你可以更容易地覆盖它)。绑定到谷歌的translate JavaScript来做很多事情已经证明是相当困难的。无论如何,摆脱iframe是最重要的部分。

2hh7jdfx

2hh7jdfx6#

这在2023年起作用:

#goog-gt-tt
{
    display:none!important;
}

字符串

相关问题