dcsimg
www.webdeveloper.com
Results 1 to 7 of 7

Thread: Can't find the fault in this code

  1. #1
    Join Date
    Aug 2010
    Posts
    3

    Exclamation Can't find the fault in this code

    Greetings,

    I've registered to this board specifically for this problem, though I'm beginning to suspect that I'll be here MUCH more often.

    Recently I've tried to add a Lightbox script to an already existing page that already had a javascript feature in it. Now I know that there's no limit to the number of scripts you can run simultaneously, but when I added the lightbox feauture, my compiler gave me the following error:

    $ is not defined
    this.elements = $(this.options.thumb...lements(this.options.itemsSelector);

    This line of code was part of the original source code of the page, and hadn't been a problem before I added the Lightbox code. Why is $ undefined all of a sudden and where can I find a solution for this? Could someone point me in the right direction here? I'm not exactly a novice(yet) when it comes to Javascript and this project was due yesterday.
    I'd appreciate it if you guys could help me.

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654

  3. #3
    Join Date
    Aug 2007
    Posts
    3,767
    That's not valid JavaScript, so there's a problem with the original source-code. Where did you get that from?

  4. #4
    Join Date
    Aug 2010
    Posts
    3
    Thanks Fang, I'm trying out your solution right now.

    @Declan: The line of code I posted is from the .js file of the original index.html page (it was a template).

  5. #5
    Join Date
    Aug 2007
    Posts
    3,767
    Quote Originally Posted by Dwinna View Post
    @Declan: The line of code I posted is from the .js file of the original index.html page (it was a template).
    But did you take the line from the error console? It's obviously not complete with the ellipsis in the middle.

  6. #6
    Join Date
    Aug 2010
    Posts
    3
    Quote Originally Posted by Declan1991 View Post
    But did you take the line from the error console? It's obviously not complete with the ellipsis in the middle.
    Yes I did actually.

    There seem to be no more conflict errors after trying and testing the methods described in Fang's link, but now the page isn't supposed to do what I originally intended it to do, which is have a javascript clickable image sidescroller, and the images themselves to pop-up in a lightbox. Now you can scroll through the images, but onClick the image just opens in a new browser window.

    Could I be in over my head here?

  7. #7
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    The sidescroller is overwriting the lightbox event handler.
    Perhaps another lightbox has both functions.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles