Problem with Google Ads slowing down another script
Hello,
I have 2 spaces with Google Ads on my pages and a jquery accordion menu. The problem is that Google ads make the menu loading really slow. All menu items appear open for 1 second and then close.
If I delete the Google ads the accordion menu behaves normally.
Can you help me? Thank you
Megan posted this at 16:36 — 30th March 2009.
She has: 11,421 posts
Joined: Jun 1999
Can you post a link to your page so we can see what's happening?
This is most likely a problem with jquery waiting until the rest page is loaded before it does anything. That's what it's doing when you use (document).ready. So if google is taking awhile to respond then jquery can't do anything until it's finished.
Not sure if there's a way to fix this... I had to remove some tracking scripts from my site because they were causing similar problems.
Megan
Connect with us on Facebook!
tochiro posted this at 16:43 — 30th March 2009.
They have: 24 posts
Joined: Oct 2008
Here is a link to the page: http://ivredimages.free.fr/croustwich/sudouest.php
You have to use IE6 or 7 because in FF the ads do not show. (do not know why)
Thank you
decibel.places posted this at 18:22 — 30th March 2009.
He has: 1,494 posts
Joined: Jun 2008
in FF 3.0.8 the ads show
but the left side ads are outside your sidebar to the left of it, probably not what you intend (display the same in IE7)
As Megan noted, it is probably an issue with page load and triggering the jquery script.
You can try writing the code for the Google ads with PHP or Javascript
Or perhaps you can use a script - that executes AFTER the jquery one - that will add your ads as innerHTML content (not sure how that will work with Google's analysis of the page content).
I developed a system to save all the AdSense codes for my site in a js file and write them as variables in specific pages, so I could maintain and change the ad codes easily in a central repository (not on my current site, on my old GeoCities Free site)
If jquery is the problem, you could try another menu, this one from Dynamic Drive is quite similar.
tochiro posted this at 18:50 — 30th March 2009.
They have: 24 posts
Joined: Oct 2008
but the left side ads are outside your sidebar to the left of it, probably not what you intend (display the same in IE7)
That is weird because in my FF 3.0.8 and IE7 the left side ads are well positioned. How come?
You can try writing the code for the Google ads with PHP or Javascript
Actually I insert the ads through PHP includes.
Or perhaps you can use a script - that executes AFTER the jquery one - that will add your ads as innerHTML content (not sure how that will work with Google's analysis of the page content).
How would you do that? Are there such scripts freely downloadable?
If jquery is the problem, you could try another menu, this one from Dynamic Drive is quite similar.
What I like with the menu I use (http://www.i-marco.nl/weblog/jquery-accordion-menu-redux2/) is that it remembers its state between pages.
greg posted this at 19:08 — 30th March 2009.
He has: 1,581 posts
Joined: Nov 2005
See the image I have attached.
I am using Firefox 3.07 (on Ubuntu)
As for why, I only briefly looked at your code..
In your main_styles.css (line 255) you have this
#googleAds {
left:110px;
padding:0 10px;
position:absolute;
top:900px;
width:180px;
}
When I remove that
left:110px;
it looks fine in my FF.I didn't try it in any other browser without the left margin.
tochiro posted this at 19:36 — 30th March 2009.
They have: 24 posts
Joined: Oct 2008
Thank you Greg for your time and input. I have done what you suggest and it looks fine now in FF and IE whereas a few hours ago I had to add "left: 110px" to have the div correctly positioned. I do not know why it now works without this rule... The weird thing is that with or without this rule, IE displays the div at the same place.
decibel.places posted this at 20:14 — 30th March 2009.
He has: 1,494 posts
Joined: Jun 2008
This page about using innerHTML should explain better than I can here - especially the links to Try It pages!
Basically, you need to create a container, a div or a p (paragraph) and give it an id name
<div id="adsense"></div>
then, later on in the page (so the container has been created/rendered) some javascript to set its content:
<script type="text/javascript">
<!--
document.getElementById('adsense').innerHTML="your adsense code here";
//-->
</script>
it would probably also work with:
<script type="text/javascript">
<!--
adsense.innerHTML="your adsense code here";
//-->
</script>
but I do not know if adding your adsense code like this will work with the adsense service...
tochiro posted this at 07:10 — 31st March 2009.
They have: 24 posts
Joined: Oct 2008
Thank you to all the contributors. I now have to try the various ideas you suggested and see what happens.
Cheers
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.