我有一个滑块和一个导航栏,都需要使用不同的jQuery版本。使用多个jQuery版本库
滑块使用1.7.2,而导航使用1.4.2
<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-1.4.2.js"></script>
<script type="text/javascript">
var $jq = $.noConflict(true);
</script>
<!-- NAVIGATION -->
<script type="text/javascript">
$jq(document).ready(function() {
$jq('#main-image-box').children().removeClass('facets').end().facets({
control: 'ul#mainlevel',
clipSpacing: 1,
animationSpeed: 400,
beforeMax: function(index) {
$('#main-image-box .clip:eq('+index+') .container').show();
},
beforeMin: function(index) {
$('#main-image-box .clip:eq('+index+') .container').hide();
}
});
});
</script>
<!-- SLIDER -->
<script type="text/javascript" src="js/jquery.nivo.slider.js"></script>
<script type="text/javascript">
(window).load(function(){
('#slider').nivoSlider();
});
</script>
正如你所看到的,我一直在使用noconflict尝试,但它不工作,我该如何解决这个问题?
[在facebook应用上使用两个jQuery库1.7.1.js和1.5.2.js](http://stackoverflow.com/questions/11235107/using-two-jquery-libraries-1- 7-1-js-and-1-5-2-js-on-a-facebook-app) – Ariel
在你的导航代码中你同时使用'$ jq'和'$',在滑块代码中你忘记了'$ ' – Musa
这就是为什么你应该学会写jQuery而不是依靠插件。如果你要依靠插件在积极的开发中挑选一些插件。 – Fresheyeball