Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    New Coder
    Join Date
    Feb 2012
    Posts
    27
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Two Javascripts on one page

    Hi All,

    I know this has been covered many times on this site, but I just cannot figure out what I'm doing wrong. I've got a jquery slideshow and some lightbox galley images that I'm trying to get to work together. I thought I had taken out the parts that were conflicting but I apparently haven't. Any help would be much appreciated.

    Here's the page I'm working on: oneeightyone.com/new/index.html

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    yup, youve made the most common mistake. you including more than one version of jquery. remove line 11( older jquery version), replace it with line 20 and you should be all set.

  • #3
    New Coder
    Join Date
    Feb 2012
    Posts
    27
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Thanks for the quick reply. The lightbox script still is not working though.

  • #4
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    woops, i should have been more literal.
    ok now remove line 20 altogether

  • #5
    New Coder
    Join Date
    Feb 2012
    Posts
    27
    Thanks
    3
    Thanked 0 Times in 0 Posts
    No worries! Got it working, although my image isn't loading. But that's something I can figure out.

    thanks for your help!

  • #6
    New Coder
    Join Date
    Feb 2012
    Posts
    27
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Actually, I'm stumped again. Any ideas?

  • #7
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    ok weird. its still nto recognizing your lightbox plugin and your getting some 404's on several of your thumb jpg's

    Im assuming those are supposed to be slides?

    ok I cleaned up you scripts sections a bit just to be sure.

    Code:
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
    <script type="text/javascript" src="http://gsgd.co.uk/sandbox/jquery/easing/jquery.easing.1.3.js"></script>
    <script type="text/javascript" src="js/jquery.lightbox-0.5.js"></script>
    <script type="text/javascript" src="js/slides.min.jquery.js"></script>
    <script type="text/javascript">
    $(function() {
    $('#gallery a').lightBox();
    });
    
    $(function(){
    $('#slides').slides({
    preload: true,
    preloadImage: 'images/loading.gif',
    play: 5000,
    pause: 2500,
    hoverPause: true
    });
    });
    </script>

  • #8
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    hey whats up with this line exactly?
    Code:
    <body onload="slides(); gallery();">
    im pretty sure you need to remove those onload events. I do not see them referenced in any of your scripts.
    Last edited by DanInMa; 03-12-2012 at 04:59 AM.

  • #9
    New Coder
    Join Date
    Feb 2012
    Posts
    27
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Some of those thumbs weren't pointing to any thing, I just took them out.

    Yeah, I thought I just had the wrong path to the image or maybe the css was off, but even after putting in your cleaned up code, I still the get the same error, it doesn't seem to want to load the larger image.

    Could it have to do with the <body onload="slides(); gallery();">? do I have that coded correctly?

  • #10
    New Coder
    Join Date
    Feb 2012
    Posts
    27
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by DanInMa View Post
    hey whats up with this line exactly?
    Code:
    <body onload="slides(); gallery();">
    I thought I needed that to have both scripts load correctly?

  • #11
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    yes remove the onload attribute altogether

    when you wrap your function like so:

    Code:
    $(function() {
    $('#gallery a').lightBox();
    });
    the
    Code:
    $(function() {
    //
    });
    part tells it lo load when the DOM is ready.

    it's the same as wrapping it in
    Code:
    $(document).ready(function(){
    
    });
    as you may have seen before. so you've already taken care of that actually.

  • #12
    New Coder
    Join Date
    Feb 2012
    Posts
    27
    Thanks
    3
    Thanked 0 Times in 0 Posts
    gotcha. But even after taking out that line, I'm still getting the same error. Those larger images just don't want to load.

  • #13
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    oh a little advice also. I take it your a graphic designer, somethign along those lines?

    Im not sure how concerned you are with page validity, but you might want to take a look at this :

    http://validator.w3.org/check?uri=ht...Inline&group=0

    Your using XHTML doctype so for example you need to close a lot of elements with /> , like IMG's for example. if your not concerned I dont see anythign earth shattering in there except maybe some extra unneeded </div> tags

  • #14
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    Quote Originally Posted by mikenap View Post
    gotcha. But even after taking out that line, I'm still getting the same error. Those larger images just don't want to load.
    actually, the browser is getting the requested image, the lightbox just isnt showing it once it has loaded for some reason

  • #15
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    Oh also, is this all you art work?, if so Nice! Love the lego Batman stuff.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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