3

为什么这对我根本不起作用?

<script type="text/javascript" src="Javascript/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript" src="Javascript/jquery-1.3.2.min.js"></script>     
<script type="text/javascript">

    $(function() {
    $('.selector').draggable({ axis: 'x' });    });

    </script>

    <body>

    <div class="selector">
        <p>Drag me around</p>
    </div>

我只是从 jQuery 网站上的可拖动示例页面复制和粘贴,它只是不起作用:(

谁能告诉我为什么?

4

2 回答 2

15

更改 javascript 包含的顺序,jQuery 核心文件始终位于第一位。

于 2009-12-03T17:52:20.493 回答
5

可能听起来微不足道,但您需要在 jQuery UI 之前加载 jQuery 库:

<script type="text/javascript" src="Javascript/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="Javascript/jquery-ui-1.7.2.custom.min.js"></script>     
<script type="text/javascript">
  $(function() {
    $('.selector').draggable({ axis: 'x' });
  });
</script>
<body>
  <div class="selector">
    <p>Drag me around</p>
  </div>
于 2009-12-03T17:56:54.110 回答