user2771898
user2771898

Reputation: 21

Multiple jQuery on one page

I am very new to jQuery and I'm having some trouble with it. I have a simple sideshow and a weather plugin that I want to use, but for some reason they both don't work when I implement them at the same time.

<script src="js/jquery.js"></script>
<script src="js/fadeSlideShow-minified.js" type="text/javascript"></script>
<script type="text/javascript" src="js/fadeSlideShow.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="jquery.zweatherfeed.min.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function(){
$('#slideshow').fadeSlideShow();
});
</script>

<script type="text/javascript">
$(document).ready(function () {
$('#test').weatherfeed(['1580050']);
});
</script>

Upvotes: 0

Views: 2314

Answers (5)

Kuldeep Vithlani
Kuldeep Vithlani

Reputation: 613

You have included

fadeSlideShow-minified.js and fadeSlideShow.js

in your script which I think they are same. Because fadeSlideShow-minified.js is the min version of fadeSlideShow.js so just remove the script tag of js/fadeSlideShow.js from your page and check it. It should work now.

Upvotes: 1

t00thy
t00thy

Reputation: 519

What is the number in

$('#test').weatherfeed(['1580050']);

If it is a WOEID, you must use it like this:

$('#test').weatherfeed(['44418'],{
    woeid: true
});

It means, that you must say to your plugin, that you use different location services than the default one.

Try Demo

Why you have implemented more than one jQuery library? Try the last jQuery version (2.0, or 1.10.2).

The are many optional reasons, why it could not work.

Hope it help you.

Upvotes: 0

Andreas Schwarz
Andreas Schwarz

Reputation: 1798

It seems you are loading two versions of jQuery and two fadeSlideShow files, try with this:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="js/fadeSlideShow-minified.js" type="text/javascript"></script>
<script src="jquery.zweatherfeed.min.js" type="text/javascript"></script>

You can write your two calls into one $(document).ready():

<script type="text/javascript">
$(document).ready(function(){
    $('#slideshow').fadeSlideShow();
    $('#test').weatherfeed(['1580050']);
});
</script>

Also, it would help if you check your JavaScript console to see if any error messages appear, and to give us the HTML code as well.

Upvotes: 2

Khawer Zeshan
Khawer Zeshan

Reputation: 9646

You only need to include jquery library once. Remove this line

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>

Upvotes: 0

ahren
ahren

Reputation: 16959

You only need ONE version of jQuery per page.

// This is one
<script src="js/jquery.js"></script>
<script src="js/fadeSlideShow-minified.js" type="text/javascript"></script>
<script type="text/javascript" src="js/fadeSlideShow.js"></script>
// This is another - delete this one.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<script src="jquery.zweatherfeed.min.js" type="text/javascript"></script>

You also don't need both the minified and unminified versions of fadeSlideShow

Upvotes: 1

Related Questions