View Full Version : Conflict with Lightbox 2 script and Google +1

01-30-2012, 10:41 AM
1) Script Title: lightbox2

2) Script URL (on DD):

3) Describe problem:

The Prototype JS script conflicts with the new Google +1 script

<g:plusone></g:plusone><script type="text/javascript">
(function() {
var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
meaning the Google +1 does not appear

The protype script is below


01-30-2012, 04:33 PM
Hi there fantazia,

That's not the Dynamic Drive Lightbox (that's why I've moved this to the javascript section), and it (as well as the version on Dynamic Drive) are outdated. But updating it might not help. But it could:


If going that route, be sure to use all of the new (version 2.05) files and none of the old 2.03 ones, as the scripts (there's even one more added), styles and perhaps even images have all changed.

Another possibility is I see that on the fantazia.org.uk domain, jQuery is also used. That can conflict with Prototype (in fact will in some browsers with that version of Prototype no matter what you do, but with jQuery in noConflict mode and a more recent version of Prototype as comes with Lightbox 2.05, it can work out). But there is a Lightbox type script called Slimbox2:


That looks and acts just like Lightbox and doesn't need Prototype. It uses jQuery. Switching to that and getting rid of Lightbox and all of its files may be the answer.

If going that route you should only need one copy of jQuery for the page but I would suggest updating it to version 1.6.4. It should go in the head before any of the other scripts that use it.

If you want more help, please post a link to the page on your site that contains the problematic code so we can check it out.

If you do link to a page, make sure it has the Lightbox script and the Plus 1 script on it and where both of those are used or trying to be used by the page. I'd also need to see a page with Plus 1 on it where Plus 1 works, as I need to know for testing purposes if it will work in a local mock up.