Scripts donít work when used together
As this has been asked many, many times and Iím tired of answering this very basic question I hope this sticky thread clarifies why two (or more) scripts/plugins may not work together while they are working alone.
Here are more elaborate explanations to the issues and solutions:
Case 1: Two incompatible frameworks
Your code might look something like this, because you followed the instructions on the websites from which you got the code and copied it into your document.
Youíve done all the right things and yet, it isnít working because you have a plugin that is using the prototype framework and another one using jQuery:
The solution: Replace one of the two plugins with a plugin for the matching JS framework, i. e. either look for a slider that is based on prototype or look for a lightbox script based on jQuery.
Case 2: Multiple references to the same framework
Choosing plugins for the same framework isnít free of errors either. This could be your code:
Note, however, that some plugins might be based on outdated versions of the core framework and might not work with newer versions. Even though youíve really done everything right this time and used one framework and included it once only, with one plugin based on, say, jQuery 1.2.6 and the other one based on jQuery 1.8, one of them will most likely not work (depending on which version of jQuery you have included/referenced) because in the meantime the code has changed, new features were added and old ones removed. Always look for the version number of the framework on which the plugins are based and try to use the most current ones.
I hope this helps anyone (and I hope anyone actually reads this). Good luck.
Just my two cents:
Best advice, as suggested, is to use one framework or the other (prototype OR jQuery etc.). No matter what plug-in or feature you would like to use, a comparable version can always be found in the other framework.
Can I also repeat the need to WAIT UNTIL THE PAGE HAS FULLY LOADED before attempting to reference any element on the page. In jQuery:
This is the most common error.
|All times are GMT +1. The time now is 01:07 PM.|
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.