View Full Version : Script Conflicts - Suggestions Needed

03-09-2010, 02:49 PM
I am testing three scripts. They are:

Typing Scroller

Text and Image Crawler

Lightbox image viewer

Individually they all work just fine.

Text Crawler works on the same page with Typing Scroller
Text Crawler works on the same page with Lightbox
Typing Scroller and Lightbox don't work on the same page

I'm looking for suggestions to resolve the conflict; specifically, what should I be looking for. I have done a quick look to see if there are any variables with the same name and don't see any.

Also, I would consider myself a 2 on a scale from 1=newbie 5=wizard scale when it comes to JavaScript.

Thanks for any suggestions. I'll be gone the rest of the day; so, I'm not being rude if I don't reply in the next 24 hours.

03-09-2010, 03:42 PM
Upgrade the typing script to:


Or update the Lightbox script to:


You can do either or both. The problem you have now is that each of the two conflicting scripts seek to take control of the page's onload event (window.onload, onload, or <body onLoad). Only one can, so the other will lose out and not be run. The reason that crawler works with either of these scripts is that it doesn't rely upon onload of the page in most cases, and when it needs onload of the page, it takes it in a way that never denies it to other scripts.

Alternatively, since the lightbox script you are using attempts to see if there is already an onload, and if so tries to combine with it, you may be able to get away with simply moving the Lightbox script tag to after the typing script. But even if this works, it would leave you open to possible future onload conflicts with the typing script and perhaps the Lightbox one as well should yet other scripts requiring onload be added to the page. Best to stick with scripts that either don't require onload or if/when they do, take it in a way that doesn't deny it to other scripts that need it. The two substitute scripts I suggested do not take over onload. The newer typing script doesn't need it. The newer Lightbox one does, but does so in a way that doesn't deny it to others. The two newer scripts also have other advantages over each of their earlier counterparts.

03-09-2010, 10:03 PM
Thanks for the explanation.

I'll check out the typing script. In the case of the lightbox, it seems like over kill. What I liked about


was that it was simple. Popped up an overlay with transparent background with no window shade effects. I guess I'll have to look and see what it will take to dumb down


Lot more js files - 6 versus 1.

03-10-2010, 09:37 AM
Not sure what you mean by:

Popped up an overlay with transparent background with no window shade effects

But it sounds like you missed/skipped the semi-transparent .png image, changed something in the css, or have something going on with your page or browser, or perhaps something else that's removing that effect.

If you like that Lightbox, you may use it. If you place it's script tag:

<script type="text/javascript" src="lightbox.js"></script>

as the last thing before your closing body tag as shown above, things should work out, no other changes, not even to the typing script you are using should be required. But, as I was saying, this just postpones likely future conflicts to a time when you may add more scripts that try to take sole control over the onload event.

However, it would be a solution to the current problem.

03-10-2010, 01:32 PM
Popped up an overlay with transparent background with no window shade effects

But it sounds like you missed/skipped the semi-transparent .png image,

Actually what I called transparent background is what you are calling semi-transparent.

Thanks again.

03-10-2010, 02:32 PM
Well you can still try the moving the Lightbox script tag as indicated in my previous post. The use or lack thereof of the semi-transparent .png makes no difference to that advice.

03-10-2010, 02:48 PM
I've got that on my list. In the meantime I'm exploring the more complex and feature rich script. I found the config section so I can make it as "dumb" as I want.

So, for now I'm exploring what each of the js files do.