WordPress.org

Ready to get started?Download WordPress

Forums

WP Float
trying to get google translate code to float (6 posts)

  1. Angus Todman
    Member
    Posted 1 year ago #

    Im only getting the code I get from google translate floating at the top of the page. Ive taken it down now though. Here is the code I'd like to use.

    <div id="google_translate_element"></div><script type="text/javascript">
    function googleTranslateElementInit() {
      new google.translate.TranslateElement({pageLanguage: 'en', layout: google.translate.TranslateElement.InlineLayout.SIMPLE, gaTrack: true, gaId: 'UA-39051346-1'}, 'google_translate_element');
    }
    </script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>

    any reason why this may not be working. Is there some special way to input this code.
    Many thanks in advance! :)

    http://wordpress.org/extend/plugins/wp-float/

  2. Angus Todman
    Member
    Posted 1 year ago #

    Im using the pinboard theme, everything up to date.

  3. samhagin
    Member
    Plugin Author

    Posted 1 year ago #

    if you are using wp float options under settings in wp-admin, make sure you enter the code in text and not visual mode. Also, what is the code supposed to show, i tried adding that on a test site and that displays nothing since the code is just a div without content

  4. Angus Todman
    Member
    Posted 1 year ago #

    Hi Sam,

    Thanks for the reply. If you look at the home page of this site you can see the 'google translate' button up the top right. Though it is fixed and not floating.

    I put this code in the header

    <meta name="google-translate-customization" content="5f1236b7ad3c9e32-c0c3fac3c04860c5-g52f2c280ec5208e6-14"></meta>

    and this code in the custom css of my theme.

    #google_translate_element {
     position: absolute;
     top: 0;
     right: 0;
    }

    I tried changing absolute to fixed though it didnt work. Maybe you know of a better way to get it fixed up the top right?

    Many Thanks for your reply!

  5. samhagin
    Member
    Plugin Author

    Posted 1 year ago #

    Can you provide the URL for the site with the issue? If you want the item to be static and not move with the page as the user scrolls, use the code below:

    <script>
    jQuery(document).ready(function(){
    jQuery('#google_translate_element').css('position','absolute');
    });
    </script>
  6. Angus Todman
    Member
    Posted 1 year ago #

    Sure, the url is as follows.

    www.globallingos.com

    Is there a way to get that code in the VERY TOP RIGHT of the page? Or can I put it in any widget area?

    Thanks again :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.