谷歌翻译代码-google translate code

第一种:

<div id="google_translate_element"></div>
<script>
    function googleTranslateElementInit() {
        new google.translate.TranslateElement(
            {pageLanguage: 'en'},
            'google_translate_element'
        );

        /*
            To remove the "powered by google",
            uncomment one of the following code blocks.
            NB: This breaks Google's Attribution Requirements:
            https://developers.google.com/translate/v2/attribution#attribution-and-logos
        */

        // Native (but only works in browsers that support query selector)
        //if(typeof(document.querySelector) == 'function') {
        //    document.querySelector('.goog-logo-link').setAttribute('style', 'display: none');
        //    document.querySelector('.goog-te-gadget').setAttribute('style', 'font-size: 0');
        //}

        // If you have jQuery - works cross-browser - uncomment this
        //jQuery('.goog-logo-link').css('display', 'none');
        //jQuery('.goog-te-gadget').css('font-size', '0');
    }
</script>
<script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

Note you can uncomment the correct bits to remove the "powered by google" - but note this breaks Google's Attribution Requirements


第二种:(来自opencart 插件Google_translate_Full_2.0:)

<style>
div#google_translate_element div.goog-te-gadget-simple{background-color: #FFFFFF; border-color: transparent;}
div#google_translate_element div.goog-te-gadget-simple a.goog-te-menu-value span{color: #000000;}
div#google_translate_element div.goog-te-gadget-simple a.goog-te-menu-value span:hover{color: #000000;}
div#google_translate_element div.goog-logo-link{display:  none ;}
div#google_translate_element div.goog-te-gadget{color: transparent; height: 14px;}
div#google_translate_element div.goog-te-gadget .goog-te-combo{color: #FF0000; background-color: #FFFFFF; border-color: #000000;}
body {position: static !important; top:0px !important;}
iframe.goog-te-banner-frame{ display: none !important;}
</style>

<div class="pull-left">
<div id="google_translate_element" ></div>
<span><script type="text/javascript">
function googleTranslateElementInit() {
  new google.translate.TranslateElement({
    pageLanguage: 'it',
    layout: google.translate.TranslateElement.InlineLayout.SIMPLE,
  }, 'google_translate_element');
}
</script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit">
</script>

</span></div>


可以对代码进行适当的修改。


发布了5 篇原创文章 · 获赞 0 · 访问量 1万+
展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览