Google翻译添加课程

时间:2015-12-07 21:29:04

标签: jquery css

是否可以使用jQuery向我的google翻译按钮添加“下拉”类? https://jsfiddle.net/tgokbf5j/6/

我试过了$("#google_translate_element").addClass("dropdown");

是否可以覆盖谷歌翻译按钮的CSS或只是添加下拉类,使其成为优先事项?

$('document').ready(function () {
  $("#google_translate_element").addClass("dropdown");
    $('#google_translate_element').on("click", function () {
        // Change font family and color
        $("iframe").contents().find(".goog-te-menu2-item div, .goog-te-menu2-item:link div, .goog-te-menu2-item:visited div, .goog-te-menu2-item:active div, .goog-te-menu2")
            .css({
                'color': '#687074',
                'font-family': 'tahoma'
            });

        // Change hover effects
        $("iframe").contents().find(".goog-te-menu2-item div").hover(function () {
            $(this).css('background-color', '#18BA9B').find('span.text').css('color', 'white');
        }, function () {
            $(this).css('background-color', 'white').find('span.text').css('color', '#687074');
        });

        // Change Google's default blue border
        $("iframe").contents().find('.goog-te-menu2').css('border', '1px solid #18BA9B');

        // Change the iframe's box shadow
        $(".goog-te-menu-frame").css({
            '-moz-box-shadow': '0 3px 8px 2px #666666',
            '-webkit-box-shadow': '0 3px 8px 2px #666',
            'box-shadow': '0 3px 8px 2px #666'
        });
    });
});
a.goog-te-menu-value { 
text-decoration:none;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
}
a.goog-te-menu-value > span { 
text-transform: uppercase;
}
div#google_translate_element div.goog-te-gadget-simple a.goog-te-menu-value span:hover {
	color:#18BA9B;
}

a.goog-te-menu-value:hover span
{
      color: #18BA9B !important;  
}
<div id="google_translate_element" style="float:left; padding-left:15px"></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>

0 个答案:

没有答案