View Full Version : multiple jquery scripts

02-15-2011, 03:44 PM
Hi There,
I added a jquery megamenu to my site, but now my thichbox script is not working correctly. I have been pulling my hair out trying to get it to work. I added a noconflict statement and changed $ to jQuery in my jquery.js file, but it is still not working correctly. Any help would be greatly appreciated. Thanks!


<script type="text/javascript" src="http://homecomforts.com/js/jquery.js"></script>
<script type="text/javascript" src="http://homecomforts.com/js/thickbox.js"></script>
jQuery.noConflict(); </script>

<link href="http://www.homecomforts.com/js/thickbox.css" rel="stylesheet" />

<script type="text/javascript" src="/js/efriend.js"></script>
<script type="text/javascript" src="http://homecomforts.com/js/jquery.min.js"></script>
<script type="text/javascript" src="http://homecomforts.com/js/jquery.hoverIntent.minified.js"></script>
<script type="text/javascript" src="http://homecomforts.com/js/megamenu.js"></script>

02-15-2011, 05:30 PM
This looks like you don't have much of a plan what you are doing, willy-nilly embedding scripts.

First of all, you're not supposed to change your jQuery.js file. jQuery is supposed to stay the way you downloaded it. If you don't like something, file a bug report or a feature request.

Second, the first script you embed (jquery.js) is not only a very old version of jQuery, at the bottom of it there's also the thickbox script right inside that file. In the second line, you're embedding the thickbox script again, so that doesn't make a whole lot of sense.

Third, noConflict() is only needed when you add another framework, which also uses "$" as global object (which is not the case here).

Fourth, what are you doing, embedding another version of jQuery here (jquery.min.js)? You're suppsed to use one version of jQuery only, and that should be the most recent (1.5). In development you're supposed to use the full version for debugging purposes, in production the minified version. Also, you're encouraged to use a CDN (as opposed to serving it yourself), because many people will already have the CDN version in their browser cache.