jQuery drop full (ok)

Bài toán 1: Tôi muốn kéo cả nội dung thẻ vào và nhân bản :)

C:\xampp\htdocs\php\practic.html

<!DOCTYPE html>
<html lang="en">
<head>
  <title>Demo</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
  <script src="https://code.jquery.com/jquery.js"></script>
  <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
  <link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
</head>
<body>
  <script type="text/javascript">
  jQuery(document).ready(function($) {
    $("#drag").draggable({
      helper: 'clone',
      tolerance: 'fit',
    });
    $('#drop').droppable({
      accerpt: '#drag',
      drop: function(e, ui) {
        x = ui.helper.clone();
        x.appendTo('#drop');
      }
    });
  });
  </script>
  <div id="wrapper">
    <div id="drag" class="drag">Lorem ipsum dolor sit amet.</div>
  </div>
  <div id="drop"></div>
  <style type="text/css">
  #wrapper {
    width: 280px;
    height: 280px;
    border: 4px solid red;
  }
  .drag {
    width: 150px;
    height: 50px;
    border: 1px solid blue;
    border: 1px solid blue;
  }
  #drop {
    width: 180px;
    height: 180px;
    border: 2px solid #000;
  }
  </style>
</body>
</html>

Last updated

Navigation

Lionel

@Copyright 2023