我正在尝试使字母可拖动以构成单词。但由于某种原因,它只是行不通。
我的 HTML:
<html>
<head>
<title>Word Maker</title>
<script type='text/javascript' src='script.js'></script>
<script src="js/jquery-1.6.2.min.js" type="text/javascript"></script>
<script src="js/jquery-ui-1.8.16.custom.min.js" type="type/javascript"></script>
<script src="js/ui/jquery.ui.draggable.js" type="type/javascript"></script>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div id="letters" class="makeDraggable">
<div id="letter1" class="makeDraggable">
<p>w</p>
</div>
<div id="letter2" class="makeDraggable">
<p>p</p>
</div>
<div id="letter3" class="makeDraggable">
<p>i</p>
</div>
<div id="letter4" class="makeDraggable">
<p>r</p>
</div>
<div id="letter5" class="makeDraggable">
<p>o</p>
</div>
<div id="letter6" class="makeDraggable">
<p>m</p>
</div>
<div id="letter7" class="makeDraggable">
<p>l</p>
</div>
<div id="letter8" class="makeDraggable">
<p>l</p>
</div>
<div id="letter9" class="makeDraggable">
<p>w</p>
</div>
<div id="letter10" class="makeDraggable">
<p>y</p>
</div>
<div id="letter11" class="makeDraggable">
<p>u</p>
</div>
<div id="letter12" class="makeDraggable">
<p>o</p>
</div>
<div id="letter13" class="makeDraggable">
<p>g</p>
</div>
<div id="letter14" class="makeDraggable">
<p>t</p>
</div>
<div id="letter15" class="makeDraggable">
<p>o</p>
</div>
<div id="letter16" class="makeDraggable">
<p>o</p>
</div>
<div id="letter17" class="makeDraggable">
<p>i</p>
</div>
<div id="letter18" class="makeDraggable">
<p>t</p>
</div>
<div id="letter19" class="makeDraggable">
<p>h</p>
</div>
<div id="letter20" class="makeDraggable">
<p>e</p>
</div>
<div id="letter21" class="makeDraggable">
<p>m</p>
</div>
</div>
</body>
</html>
JS代码:
$(function() {
$("letters").draggable();
});