• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Popup windows appearing in the wrong place

#1
Using XenForo 1.1.1

Everything seems to be working OK in an unmodified installation. But when I try to add the Google Translate code to ad_header (I want it at the top right of the forum pages) :

Code:
<divid="google_translate_element"style="float:right; font-size:small;"></div><scripttype="text/javascript">function googleTranslateElementInit(){new google.translate.TranslateElement({
pageLanguage:'en'},'google_translate_element');}</script><scripttype="text/javascript"src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
You can reproduce it by clicking on a forum, and then move the mouse over the thread titles (but don't click). You're supposed to get a popup appearing just above the mouse showing the first couple of lines of that thread. But what I (and my users) get is a popup appearing at the bottom of the page when I hover over the first thread, and nothing at all appearing for subsequent threads (probably trying to display below the bottom of the window).

The popup windows that appear when you hover over a thread title in a forum no longer appear in the correct place -- the first one is at the bottom of the page and the subsequent ones don't appear at all (below the visible window?). When I switch back to the default style everything works as expected.

The same thing happens when I tried putting it in ad_above_content, or in any other ad_* except the sidebar (which isn't a workaround because it's not visible on the messages page).

Any ideas on how to fix / work around this?
 

Jake Bunce

XenForo moderator
Staff member
#3
Your tag names are messed up by lack of spacing. Use this:

Code:
<div id="google_translate_element" style="float:right; font-size:small;"></div><script type="text/javascript">function googleTranslateElementInit(){new google.translate.TranslateElement({
pageLanguage:'en'},'google_translate_element');}</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
 
#4
Your tag names are messed up by lack of spacing. Use this:
Makes no difference; it does exactly the same thing. (My original script was multiline but got mangled somehow by the bbcode.)

The script as supplied by Google (without the code block):

-----------
<div id="google_translate_element" style="float:right"></div>
<script type="text/javascript">
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en'
}, 'google_translate_element');
}
</script><script type="text/javascript" src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>
-----------

(And yes, the </div> does look a little odd, but that's how Google had it, and moving it to the end makes no difference.)
 

Jake Bunce

XenForo moderator
Staff member
#5
I have confirmed the problem on my forum. It's obviously a conflict with Google's code since the problem only happens when that code is present. Unfortunately I don't have a fix for you.