Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lightbox prevents other script from working

Status
Not open for further replies.

TheAwake

Programmer
Jul 28, 2003
37
0
0
Hello everyone,

I need to use lightbox 2 ( and a custom scrollbar script ( on the same webpage, but as soon as I add lightbox to the page the scrollbar script wont work anymore.

You can see my simple test page with both scripts applied here:

Ive made a zip folder of the test directory that you can download here in case you're willing to try any solutions that might have come to your mind:
I dont have much knowledge of javascript, so I hope (but dont expect) that the fault is in my sourcecode.

Id be more than happy if someone could give me directions on this issue, thanks in advance!
 
I'm afraid to click your links because they have the word interbreed in them...

Anyway, without looking at your source code I'm going to guess that both scripts you've loaded have a window.onload event defined. One of them is likely overwriting the other. You should create an addLoadEvent function (these can be found on google) and use that instead of explicitly defining window.onload.

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
Hello,

no need to be afraid, the term interbreed in this case refers to crossing peoples creative output.

I did my homework and googled about this issue before I posted here and stumbled across the onload problem, however only the lightbox.js document contains that event and it even states
"Adds event to window.onload without overwriting currently assigned onload functions."

So I doubt that this is the source of the trouble in this case.
Thanks for the suggestion, though.
 
Well my "code" still is here:

If you look at it its just a white page with a div on it so its not like there are heaps of troublesome sourcecode.

When i check my error console it just says:
$("#pane2") has no properties

Doesnt sound too important...
 
I did some searching and came across a few things:

1) jquery (base of the scrollbar script) uses "$" as a shortcut for "jQuery"
(
2) Somebody else used jquery with lightbox 2 and had a problem close to mine and solved it by replacing all $ with jquery
( however Im not skilled enough to apply that method.

3) Someone made a jquery lightbox 2 plugin ( which should also eliminate the $ trouble (its not proven that this is in fact the source of the issue) but I cant get it to work either...

Is anyone willing to help? I cant release the site without both of the scripts working so this is very important to me...
 
Not sure how this works, but by the looks of it, you haven't connected pane2 to the jQuery functionality.

By the way, to review JavaScript code more easily, send it through a beautifier. I use:
I'll review this further, but for now, I have to get back to painting the bedroom or my girlfriend will not let me hear the end of it.

Darrell
 
Hmmm...

Put on the 2nd coat of paint.

Looking at this again...

I just looked at the docs for the jScroll function and it looks like you had it right. Argh!

Maybe you've got some type of name collision, but I doubt it.

I'll check some more. This is a good one as I'm very interested in mastering jQuery.

Darrell
 
Hello Darrell,

your interest is hightly appreciated! The method of replacing all the $ variables with jquery i posted earlier sounded somewhat good, however I really expected the jquery lightbox plugin to work out since both scripts use the same library, but I couldnt get it to work. I still think its the most reasonable way of approaching the issue.

good luck with that bedroom :)
 
TheAwake,

I'm curious about this line in your page:
<script src="/mint/?js" type="text/javascript"></script>

Darrell
 
ok i solved the problem by using the jqery lightbox plugin and not loading the jquery-1.2.1.min.js file...thanks everyone for the support.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top