0

I am working on a HTML page and I want to use jQuery for my slide-show and pop-out image (The jQuery-lightbox) on a same page. However, when I active these two function at the same time, the pop-out image function works, but the slide-show section stopped working. Maybe I wrote the function in a wrong way....

I appreciate your help!

Here is my code:

<head>
<!--slideshow-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="nivo-slider/jquery.nivo.slider.pack.js" type="text/javascript"></script>
<script type="text/javascript">
    $(window).load(function() {
      $('#slider').nivoSlider({

        effect:'random',

    });
});
</script>

<!--Lighbox-popout-->
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.lightbox-0.5.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.lightbox-0.5.css" media="screen" />
<script type="text/javascript">
    $(function() {
      $('#photo a').lightBox();
});
</script>
</head>

4 Answers 4

2

you're loading two different versions of jquery that are interfering with each other. get rid of this line:

<script type="text/javascript" src="js/jquery.js"></script>

and see if that helps.

Sign up to request clarification or add additional context in comments.

Comments

1

Don't use window.load use $(function() { ... }). Also, the DOM isn't ready when your are calling for lightbox.

Comments

1

You're including 2 versions of jQuery it seems, disable one or the other and see if will work then.

Also, lose the trailing comma in the line effect:'random',, some browser will choke on that.

Comments

1

Use this

<head>
<!--slideshow-->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript"></script>
<script src="nivo-slider/jquery.nivo.slider.pack.js" type="text/javascript"></script>
<!--Lighbox-popout-->
<script type="text/javascript" src="js/jquery.lightbox-0.5.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery.lightbox-0.5.css" media="screen" />
<script type="text/javascript">
    $(function() {
      $('#photo a').lightBox();
              $('#slider').nivoSlider({effect:'random'});
});
</script>
</head>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.