[英]how to bootstrap.js confliction with two versions of jquery
我有一個來自主頁的jquery版本。
<script src="~/Content/Bootstrap/jquery-1.6.4.min.js"
type="text/javascript"></script>
我在查看頁面上擁有新版本的jquery和bootstrap。
<script src="~/Content/Bootstrap/bootstrap.min.js" type="text/javascript"></script>
<script src="~/Content/Bootstrap/jquery-1.11.3.min.js"
type="text/javascript"></script>
<script>
var jquery1.11 = jQuery.noConflict(true);
</script>
雖然通過不使用沖突解決了兩個版本的jquery之間的沖突問題,但是bootstrap.js引發了錯誤Bootstrap's JavaScript requires jQuery version 1.9.1 or higher
版本,因為它引用的是1.6.4
和在控制台$.fn.jquery = "1.6.4"
如何解決此引導問題?
如果您更改腳本的加載順序,則應該可以正常工作...
<!-- load original jquery -->
<script src="~/Content/Bootstrap/jquery-1.6.4.min.js" type="text/javascript"></script>
<!-- scripts run here will use `jQuery` and `$` version 1.6.4 -->
<!-- load new jquery (to be used by bootstrap) -->
<script src="~/Content/Bootstrap/jquery-1.11.3.min.js" type="text/javascript"></script>
<!-- load bootstrap, which will use new jquery -->
<script src="~/Content/Bootstrap/bootstrap.min.js" type="text/javascript"></script>
<!-- scripts run here will use `jQuery` and `$` version 1.11.3 -->
<!-- give $ back to original jquery -->
<script>var jquery11 = jQuery.noConflict(true);</script>
<!-- scripts run here will use `jQuery` and `$` version 1.6.4 -->
<!-- scripts can access version 1.11.3 with jquery11 -->
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.