...

View Full Version : Two Javascripts on one page



mikenap
03-12-2012, 03:14 AM
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

DanInMa
03-12-2012, 03:30 AM
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.

mikenap
03-12-2012, 03:55 AM
Thanks for the quick reply. The lightbox script still is not working though.

DanInMa
03-12-2012, 04:06 AM
woops, i should have been more literal.
ok now remove line 20 altogether

mikenap
03-12-2012, 04:20 AM
No worries! Got it working, although my image isn't loading. But that's something I can figure out.

thanks for your help!

mikenap
03-12-2012, 04:35 AM
Actually, I'm stumped again. Any ideas?

DanInMa
03-12-2012, 04:42 AM
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.


<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>

DanInMa
03-12-2012, 04:48 AM
hey whats up with this line exactly?
<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.

mikenap
03-12-2012, 04:55 AM
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?

mikenap
03-12-2012, 04:56 AM
hey whats up with this line exactly?
<body onload="slides(); gallery();">

I thought I needed that to have both scripts load correctly?

DanInMa
03-12-2012, 05:01 AM
yes remove the onload attribute altogether

when you wrap your function like so:


$(function() {
$('#gallery a').lightBox();
});

the


$(function() {
//
});

part tells it lo load when the DOM is ready.

it's the same as wrapping it in
$(document).ready(function(){

});

as you may have seen before. so you've already taken care of that actually.

mikenap
03-12-2012, 05:10 AM
gotcha. But even after taking out that line, I'm still getting the same error. Those larger images just don't want to load.

DanInMa
03-12-2012, 05:11 AM
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=http%3A%2F%2Foneeightyone.com%2Fnew%2Findex.html&charset=%28detect+automatically%29&doctype=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

DanInMa
03-12-2012, 05:13 AM
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

DanInMa
03-12-2012, 05:14 AM
Oh also, is this all you art work?, if so Nice! Love the lego Batman stuff.

mikenap
03-12-2012, 05:23 AM
Thanks! This is all my work. I'm a graphic/web designer/illustrator. I'm self taught when it comes to web design, so my code is a little rough. Plus I've been doing everything with tables for so long so I'm not so strong with divs. Which is why I'm trying to work on updating my site a bit.

I am actually going to call it a night. Hopefully I'll be able to see things better tomorrow. I feel like there's just one little bit I'm missing, and it's probably real obvious.

Thank you so, so much for all your help!

DanInMa
03-12-2012, 05:32 AM
Thanks! This is all my work. I'm a graphic/web designer/illustrator. I'm self taught when it comes to web design, so my code is a little rough. Plus I've been doing everything with tables for so long so I'm not so strong with divs. Which is why I'm trying to work on updating my site a bit.

I am actually going to call it a night. Hopefully I'll be able to see things better tomorrow. I feel like there's just one little bit I'm missing, and it's probably real obvious.

Thank you so, so much for all your help!
I fgured :). If you cant get the lightbox to work, id suggest finding a newer one, becuase the image was defintely being retrieved by the browser.

take a look at that validation link I posted. thats a great way to learn where you are going wrong on your xhtml. alos you might want to look at using a tool like htmltidy online to help you.

mikenap
03-12-2012, 06:06 AM
I'll definitely check that out. Thanks again!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum