Reputation: 7397
I am running into a padding issue with Google Translate. When you click on the select language button and the menu drops down the very last row (words) sit right on top of the border in IE and Chrome (Firefox works ok), but the catch is if you click the drop down again to reopen it again the padding is fixed.... I cannot figure out why this is happening its like the second time it is entered it automatically knows to correct itself. Will someone please enlighten me why this is happening? And if you have any ideas on how to correct it.
https://jsfiddle.net/tgokbf5j/4/
$('document').ready(function () {
$('#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;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<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>
Upvotes: 0
Views: 494
Reputation: 385
*
is a meta character which stands for all. Here is a reference to the jQuery documentation.
Remove the *
from this line:
$("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 *")
And it should work as you expect.
Upvotes: 1