WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Google AJAX Translation] Is it possible to do the following... (4 posts)

  1. pikahyper
    Member
    Posted 4 years ago #

    I am thinking about making a modification to Google AJAX Translation and was wondering if what I wanted to do would be possible without too much work.

    I want to make it so the translate popup opens in the direction with more room, currently if it is at the bottom of a page and you click translate it opens down making the page a little bit longer and you have to scroll to get to the full translate menu, what I want to do is make it open down or up depending on if there is enough room below the link.

    Does this sound possible? and if so any suggestions on where to start/what to do?

  2. monodistortion
    Member
    Posted 4 years ago #

    Yes, you could probably do that. It hasn't bothered me that much so I haven't looked into it myself.

    Do you know jQuery and JavaScript? There are JavaScript and jQuery tooltips and popups that work like that.

    To make changes to this plugin you have to:

    1. Uncomment line 281 in ajaxtranslation.php so that it loads the uncompressed version of google-ajax-translation.js
    2. Comment out the second section of jquery.translate-1.3.9.min.js so that it doesn't load that.
    3. Make your changes to google-ajax-translation.js

    The logic works something like this:
    First decide if you want the popup to stay within the window or the page, two different things.

    When the popup is hidden the browser doesn't know how tall it is. It could have anywhere from 1 to 43 languages and the font size changes the size of the box, so it has to be shown first and then it has a specific height after that. That prevents you from using the slideDown animation but you could use a fadeIn.

    So, show the popup first and find out how tall it is and where the bottom edge is.

    If the bottom edge of the popup is past the bottom of the page (or window) put the popup above the "Translate" button.

    Then if the top edge of the popup is above the top of the page (or window) put the popup back below the "Translate" button.

    Something like that... from what I've read.

  3. pikahyper
    Member
    Posted 4 years ago #

    thank you, I am pretty good with jQuery so I will give it a shot :D

  4. brianpark
    Member
    Posted 4 years ago #

    Hey Pikahyper, did you come up with something? I'd like to do exactly this and have gotten as far as actually changing things in google-ajax-translation.js because my jQuery is pretty weak.

Topic Closed

This topic has been closed to new replies.

About this Topic