使用下面的组合框拖动图像

时间:2017-03-23 22:07:56

标签: javascript jquery draggable

如何使用jquery draggable在下面用combobox拖动图像。

我不知道我是否需要创建一个Div并在里面放置图像和组合框。

我已经将图像拖动了,但我不确定如何将组合框放在下面。

1 个答案:

答案 0 :(得分:0)

如果没有列出任何代码,很难判断,但这里是可拖动文档的设置:

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>jQuery UI Draggable - Default functionality</title>
  <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
  <link rel="stylesheet" href="/resources/demos/style.css">
  <style>
  #draggable { width: 150px; height: 150px; padding: 0.5em; }
  </style>
  <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <script>
  $( function() {
    $( "#draggable" ).draggable();
  } );
  </script>
</head>
<body>
 
<div id="draggable" class="ui-widget-content">
  <p>Drag me around</p>
</div>
 
 
</body>
</html>

好像你需要id为“draggable”的元素下方的框。您可以像使用$(“#dragable”).draggable();

一样将框设置为可放置的。

但同样,代码示例会非常有用。