【问题标题】:How to add drag n drop functionality in rails [closed]如何在rails中添加拖放功能[关闭]
【发布时间】:2017-02-02 04:36:07
【问题描述】:

我想在我的应用程序中添加拖放功能,例如 Draw.io 和 trello。意思是我需要在我的应用页面中快速拖放。但我知道怎么做?

请给我一些指导?

【问题讨论】:

    标签: javascript jquery ruby-on-rails drag-and-drop drag


    【解决方案1】:

    您可以使用 Jquery-ui 的Draggable

     $( function() {
        $( "#draggable" ).draggable();
      } );
    <!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>
     </head>
    <body>
     
    <div id="draggable" class="ui-widget-content">
      <p>Drag me around</p>
    </div>
     
     
    </body>
    </html>

    运行 sn-p 并检查。

    Here is the fiddle

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多