Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 15th May 2011, 05:50 PM   #1
Mkj
HyperActive Warrior
 
Join Date: 2011
Posts: 198
Thanks: 3
Thanked 19 Times in 19 Posts
Default
Code For Fixed Google translate tool...
Share on: 
fb share twitter share gplus share more share

Hi

Simple coding to add a Google translate fixed tool to your website.

The code below will add a Google translate tool to a website page which will remain active and fixed to the bottom of the page during scrolling.

Alter the styling to suit your own site. Put this into your styling css file:

#bottom {
width: 100%;
position: fixed;
bottom: 0px;
text-align: center;
font-family: Arial;
font-size: 12px;
text-transform: uppercase;
}
#bottom a {
color: #000000;
text-decoration: none;
font-weight: normal;
border: 1px solid #C0C0C0;
font-size: 11px;
text-transform: uppercase;
padding-left: 3px;
}
#bottom a:hover {
color: gray;
}

Into the footer of your site - above the </body> tag put this code:

<div id="bottom">
<center>
<div style="height: 23px; width: 958px;">
<div id="google_translate_element" style="width: 170px; float: right; text-align: right;"></div><script>
function googleTranslateElementInit() {
new google.translate.TranslateElement({
pageLanguage: 'en',
layout: google.translate.TranslateElement.InlineLayout.SIM PLE
}, 'google_translate_element');
}
</script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit" defer="defer"></script>
</div>
<center>
</div>

Alter the 'width: 958px' part of the above coding to suit the width of your site. If you have a fluid width site then put use percentages instead - 99% or 98% (so that the scroll bar doesn't show).

The above code is easily adjusted. If you want the Google translate tool on the left of your screen then alter this part - 'float: right;' of the google_translate_element div to 'float: left'. If you want the tool on the top of your site then alter these styling tags - 'bottom: 0px' to 'top: 0px'. Add another styling tag to '#bottom' such as 'margin-top: 10px' etc to adjust the positioning further.

You can see the above on my own site - see sig below.

Enjoy!
Mkj is offline  
Closed Thread


Bookmarks

Tags
bar, code, fixed, google, translate


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 03:39 AM.