All Components

Drag and Drop / Area

Drag the small circle here ...
... Or here.

HTML5/JavaScript 源码

<!DOCTYPE html>
  <meta charset="utf-8"> 
  <link href="../content/shared/styles/examples-offline.css" rel="stylesheet"> 
  <link href="../../styles/kendo.common.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.rtl.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.default.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.min.css" rel="stylesheet"> 
  <link href="../../styles/kendo.dataviz.default.min.css" rel="stylesheet"> 
  <script src="../../js/jquery.min.js"></script> 
  <script src="../../js/kendo.all.min.js"></script> 
  <script src="../content/shared/js/console.js"></script> 
  <a class="offline-button" href="../index.html">Back</a> 
  <div id="example"> 
   <div class="demo-section k-content"> 
    <div id="droptarget"> 
     <div class="test1">
      Drag the small circle here ...
     <div class="test2">
      ... Or here.
    <div id="draggable"></div> 
        function draggableOnDragStart(e) {
            $("#droptarget").html("<div class='test1'>(Drop here)</div><div class='test2'>(Drop here)</div>");

        function droptargetOnDragEnter(e) {
            $(e.dropTarget).text("Now you can drop it.");

        function droptargetOnDragLeave(e) {
            $(e.dropTarget).text("(Drop here)");

        function droptargetOnDrop(e) {
            $(e.dropTarget).text("You did great!");

        function draggableOnDragEnd(e) {
            var draggable = $("#draggable");

            if (!"kendoDraggable").dropped) {
                // drag ended outside of any droptarget
                $("#droptarget").html("<div class='test1'>(Try again)</div><div class='test2'>(Try again)</div>");


        $(document).ready(function() {
                hint: function() {
                    return $("#draggable").clone();
                dragstart: draggableOnDragStart,
                dragend: draggableOnDragEnd

                filter: ".test1, .test2",
                dragenter: droptargetOnDragEnter,
                dragleave: droptargetOnDragLeave,
                drop: droptargetOnDrop
        .demo-section {
            padding-top: 100px;
            position: relative;
        #draggable {
            cursor: move;
            position: absolute;
            top: 30px;
            left: 50%;
            margin-left: -28px;
            width: 56px;
            height: 56px;
            border-radius: 50%;
            background-color: #03a9f4;
            box-shadow: 0 3px 10px rgba(0, 0, 0, 0.23), 0 3px 10px rgba(0, 0, 0, 0.16);

        #droptarget {
            padding: 20px;
            cursor: default;
            vertical-align: middle;
            text-align: center;
            border: 2px dotted #ccc;

        .test2 {
            vertical-align: middle;
            display: inline-block;
            width: 100px;
            height: 100px;
            line-height: 1.5em;
            margin: 10px;
            padding: 20px;
            font-size: 14px;
            font-weight: normal;
            color: #fff;
        .test1 {
            background-color: #3f51b5;
        .test2 {
            background-color: #ee6f0b;

        *+html .test1,
        *+html .test2 {
            margin-top: 50px;
            display: inline;
            zoom: 1;