浏览器如何处理jquery库?

时间:2015-06-12 19:48:21

标签: html5 browser

我有这样的代码:

parent.html:
<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
</script>
<script src="jquery-ui-1.11.4/jquery-ui.min.js"></script>
<script>
$(function() {
    $("#test").draggable().click(function() {
        $("#objeto").attr('data', "child2.html").draggable();
    });
});
</script>
</head>
<body>
    <h2 id="test">text(draggable/click)</h2>
    <object id="objeto" data="child1.html"></object>
</body>

child2.html:
<head>
<script
src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js">
</script>
<script src="jquery-ui-1.11.4/jquery-ui.min.js"></script>
<script>
$(function() {
    $("#text").draggable();
});
</script>
</head>
<body id="text">child2 (draggable)
</body>

这是正常的,父加载了child1内容,如果你点击“text”它会切换到child2,但我想知道的是:

  1. 我是否下载了jquery.min.js和jquery-ui.min.js 2次?或者是第二次从缓存中撤出? (因为我再次要求同一个文件)
  2. 有没有一种方法可以使用jquery而不包含在孩子的标题上? (因为它已经在父母身上了)

0 个答案:

没有答案
相关问题