Treehouse: Grow your CSS skills. Land your dream job.

Lightbox 2 problems

  • # November 14, 2011 at 10:09 am


    Can anyone please help. I am trying to use the jquery lightblox 2 for the first time, but its not working !!….can anyone help….it is probably just something basic !!


    # November 14, 2011 at 11:31 am

    At a glance, it looks like you’re loading 2 different copies of jQuery. The second copy (a local copy called jquery.js) is being loaded after the jQuery plugins. My guess is you’re overwriting the plugins because that second jQuery copy redefines the variable on which the plugins reside.

    The JavaScript errors sort of confirm this:

    • has no method ‘cycle’
    • has no method ‘lightbox’
    • has no method ‘cycle’

    Try removing that second reference and see if it solves the problem.

    # November 14, 2011 at 11:50 am

    Thanks for the advice akeenlabs.

    I have tried removing it, but still will not work !

    Any other ideas ?

    # November 14, 2011 at 12:05 pm

    What’s the @ symbol for in the following line?


    It’s giving a syntax error.

    # November 14, 2011 at 1:43 pm

    I’m showing a 500 internal server errors on several of your files:

    • jquery.lightbox-0.5.css
    • scripts.js
    • jquery.lightbox-0.5.js

    The only JavaScript error I’m seeing is “object has no method ‘lightBox'”; since the lightbox file isn’t being served, that makes sense.

    Also, thomas is right, the @ symbol should not be there.

    # November 15, 2011 at 2:56 pm

    Right ok, so i have tried it all again, but now when i try it stops the jquery image fader working and the lightbox still will not work !!!! :(

    # November 16, 2011 at 10:46 am

    Now, your prototype.js is throwing an error: “Object #has no method ‘dispatchEvent'”. Which browser are you using to test with? I recommend either Firefox + Firebug or Chrome so you can see these error messages easily yourself.

    Even if you weren’t getting that error, I don’t see the JavaScript for your lightbox in there anymore, so I wouldn’t expect that part to work anyways :)

    As a side note, your cycle library uses jQuery while your lightbox uses Prototype. I don’t think this is a good idea as they can mess with each other. Pick one JS library and use it, don’t mix and match. If you want to use jQuery, checkout Colorbox or just search Google and pick one. This may be where the dispatchEvent error is coming from.

    # November 18, 2011 at 5:10 pm

    Ok Thanks for the help.

    I have changed it to a jquery lightbox but still no joy ahhhh !! :(

    # November 19, 2011 at 3:47 am

    My bad. I had the jquery path link wrong. Thanks for the help

    # November 19, 2011 at 6:49 am

    @akeenlabs: The “@” symbol in the selector was the original jQuery selector method for attributes… so whenever you see it, it means the code is using jQuery 1.2 or something, so it’ll need to be removed if you plan on using an updated version.

    @hal8: That gallery page is still loading two copies of jQuery: 1.2.3 and 1.4.2. And right now I see an error that it doesn’t recognize the jQuery cycle plugin because of this. So I recommend replacing this code

    with this code (updated jQuery included).

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.