当光标在Google翻译网页上的文字上时,文字会消失

时间:2017-05-12 10:55:06

标签: javascript jquery html

我用谷歌翻译翻译了一个网页。但是当我们对翻译文本进行诅咒时,文本就会消失。

有人能说出如何解决这个问题吗?

http://careturtle.com/firebase/translate_test.php

<!doctype html>
<html>
    <head>
        <title>Translator</title>
        <script type="text/javascript" src="jquery.min.js"></script>
        <script src="jquery.cookie.js"></script>    
        <style type="text/css">
        .goog-te-banner-frame.skiptranslate{display:none!important;}
        body{top:0px!important;}
        div#goog-gt-tt{display:none!important;}.goog-text-highlight{display:none!important;opacity:0;}
        </style>
    </head>
    <body>
        <script type="text/javascript">
        $.cookie('googtrans', '/en/hi');
        </script>
        <div id="google_translate_element" style="display: none;"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
    This is a test website.
    </body>
</html>

1 个答案:

答案 0 :(得分:0)

我添加了 google class 附加的<p>标记的样式并隐藏了该元素。那没有急剧眨眼。

希望可以帮到你

谢谢

<!doctype html>
<html>
    <head>
        <title>Translator</title>
        <script type="text/javascript" src="jquery.min.js"></script>
        <script src="jquery.cookie.js"></script>    
        <style type="text/css">
        .goog-te-banner-frame.skiptranslate{display:none!important;}
        body{top:0px!important;}
        div#goog-gt-tt{display:none!important;}.goog-text-highlight{display:none!important;opacity:0;}
        </style>
<style>
p.appearnone font font{
        display: block !important;
        opacity: 1 !important
}
</style>
    </head>
    <body>
        <script type="text/javascript">
        $.cookie('googtrans', '/en/hi');
        </script>
        <div id="google_translate_element" style="display: none;"></div><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
    <p class="appearnone">This is a test website.
    </body>
</html>