Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

198
Views
google translate js some troubles on iphone

google translate always working without click translate button only iphone

how can fix it? or useful document, or other way

-check

win10 : chrome lastest ver, IE11 is fine.

android : chrome, samsung internet browser is fine.

macOS(check ver. Catalina 10.15) : safari is fine.

-script

<script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
<script type="text/javascript">
function googleTranslateElementInit()
{
    var d_width = $(window).width();

    if (d_width > 1024)
    {
        new google.translate.TranslateElement({
            pageLanguage: 'en',
            includedLanguages: 'ne,ru,...', 
            layout: google.translate.TranslateElement.InlineLayout.SIMPLE, 
            multilanguagePage: true
        }, 'google_translate_element');
    }
    else
    {
        new google.translate.TranslateElement({
            pageLanguage: 'en', 
            includedLanguages: 'ne,ru,...', 
            multilanguagePage: true 
        }, 'google_translate_element');
    }
}

setTimeout(function() {
    document.getElementById('google_translate_element').addEventListener('click', function() {
        const langArr = {
            "en": "English", 
            "hi": "Hindi",
            //...
        }
        var d_width = $(window).width();
        if (d_width > 1024)
        {
            const langItems = document.querySelector('.goog-te-menu-frame').contentWindow.document.querySelectorAll('.goog-te-menu2 a');
            
            for(let i = 0; i < langItems.length; i++) {
                langItems[i].children[0].children[1].innerText = langArr[langItems[i].value];
            }
        }else{
            const langSelect = document.querySelector('.goog-te-combo');

            for(let i = 0; i < langSelect.options.length; i++) {
                if(langSelect.options[i].value != ""){
                    langSelect.options[i].innerText = langArr[langSelect.options[i].value];
                }
            }
        }
    });
}, 100);

</script>

html

<div class="googtranslate_wrap">
    <div class="container">
        <div class="googtrans_txtbox">
            <p class="tlt">title</p>
            <p class="eng_txt">text</p>
        </div>
        <div class="google_box">
            <div id="google_translate_element"></div>
            <p>Choose your Language</p>
        </div>
    </div>
</div>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!