谷歌翻译代码-google translate code

xiaoxiao2021-02-28  30

第一种:

<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>

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

转载请注明原文地址: https://www.6miu.com/read-1650248.html

最新回复(0)