我可能在這裏問一個真正的愚蠢問題,但無法找到任何好的閱讀材料來讓我放心。單個頁面上的多個jquery文件
我接管了一個使用幾個不同的jquery文件的項目。目前他的標題看起來像:
<head>
<title>
Capture New Order
</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="/application/assets/CSS_JS/jquery.mobile-1.1.1.min.css" />
<link rel="stylesheet" href="/application/assets/CSS_JS/green.min.css" />
<script src="/application/assets/CSS_JS/jquery-1.7.2.min.js"></script>
<script src="/application/assets/CSS_JS/jquery.mobile-1.1.1.min.js"></script>
<link rel="stylesheet" href="/application/assets/CSS_JS/elf.css" media="screen">
<link href="<?php echo base_url() ?>application/css/ui-lightness/jquery-ui-1.8.custom.css" media="screen" type="text/stylesheet" rel="stylesheet">
<script src="<?php echo base_url() ?>application/scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
<script src="<?php echo base_url() ?>application/scripts/jquery-ui-1.10.1.custom.min.js" type="text/javascript"></script>
<link rel="stylesheet" href="<?php echo base_url() ?>application/css/sales.css" />
<script type="text/javascript">
$(function(){
$("#customer").autocomplete({
source: "get_customers"
});
});
</script>
</head>
在這個例子中,我調用各種jquery文件4次。但是,如果我刪除這些jquery文件中的任何一個,就會破壞網站的功能。
是否沒有一個具有所有可用功能的「主」jquery文件?
當然,這會比有幾個不同的jQuery文件更有意義嗎?
道歉,如果這是一個'簡單'的問題,但只是想澄清一些。
感謝, 瑞恩你加載主文件的jQuery兩次
這裏有什麼問題?很難更新文件?試圖減少http請求的數量?要麼? – kyooriouskoala 2013-03-14 08:22:53
感謝您的時間,沒有真正的關注,只是在上傳幾個不同的文件時會浪費時間呢?另外,如果您更改文件的順序,它們會互相覆蓋,因此當您需要新版本的Jquery時,需要一些操作才能使功能正常工作。 – JustStarting 2013-03-14 08:27:11