annotate src/index.html @ 8:969d5980b375

add lists
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 23 Apr 2023 23:55:37 -0600
parents 4d699321068f
children eee8862be4c7
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
1 <!doctype html>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
2 <html>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
3 <head>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
4 <meta name="viewport" content="width=device-width, initial-scale=1">
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
5 <style>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
6 @import "/site.css";
5
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
7
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
8 code {
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
9 white-space: pre-line;
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
10 display: block;
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
11 margin-left: 32px;
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
12 }
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
13 </style>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
14 <title>Reactionary Drag and Drop</title>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
15 </head>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
16 <body>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
17 <h1>Reactionary Drag and Drop</h1>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
18
1
9c372fce698a start alternatives
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
19 <p>I can't find a usable drag-and-drop JavaScript library, so, as usual, I am forced to write one. You can follow my progress, starting from zero, right here. Here is <a href="https://hg.reactionary.software/repo/dad/">the source</a>. Here is <a href="http://www.reactionary.software/drag.html">the need</a>. And here are discussion threads on <a href="https://communities.win/c/programming/p/16an5RSxmy/javascript-drag-and-drop/c">Scored</a> and <a href="http://www.mikraite.org/JavaScript-Drag-and-Drop-tp3229.html">Reactionary Software</a> if you want to comment.</p>
9c372fce698a start alternatives
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
20
3
6d5e4b38b4fb start drag
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
21 <p>I will start by reviewing some of the existing depraved alternatives:</p>
1
9c372fce698a start alternatives
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
22 <ul>
9c372fce698a start alternatives
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
23 <li><a href="/alternatives/standard.html">Standard Drag and Drop API</a></li>
9c372fce698a start alternatives
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
24 <li><a href="/alternatives/interactjs.html">interact.js</a></li>
2
264646feb67b add draggabilly
Franklin Schmidt <fschmidt@gmail.com>
parents: 1
diff changeset
25 <li><a href="/alternatives/draggabilly.html">Draggabilly</a></li>
1
9c372fce698a start alternatives
Franklin Schmidt <fschmidt@gmail.com>
parents: 0
diff changeset
26 </ul>
3
6d5e4b38b4fb start drag
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
27
6d5e4b38b4fb start drag
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
28 <p>Time to write my own. Here are some examples:</p>
6d5e4b38b4fb start drag
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
29 <ul>
6d5e4b38b4fb start drag
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
30 <li><a href="/examples/simple.html">Simple</a></li>
6d5e4b38b4fb start drag
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
31 <li><a href="/examples/handle.html">Handle</a></li>
4
0130ae25ef94 add drop
Franklin Schmidt <fschmidt@gmail.com>
parents: 3
diff changeset
32 <li><a href="/examples/drop.html">Drop</a></li>
6
4d699321068f add dropzones
Franklin Schmidt <fschmidt@gmail.com>
parents: 5
diff changeset
33 <li><a href="/examples/dropzones.html">Dropzones</a></li>
8
969d5980b375 add lists
Franklin Schmidt <fschmidt@gmail.com>
parents: 6
diff changeset
34 <li><a href="/examples/list.html">List</a></li>
969d5980b375 add lists
Franklin Schmidt <fschmidt@gmail.com>
parents: 6
diff changeset
35 <li><a href="/examples/list2.html">Dynamic List</a></li>
3
6d5e4b38b4fb start drag
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
36 </ul>
6d5e4b38b4fb start drag
Franklin Schmidt <fschmidt@gmail.com>
parents: 2
diff changeset
37 <p>These use <a href="/dad.js">dad.js</a> and <a href="/dad.css">dad.css</a>.
5
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
38
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
39 <p>When dragging starts, this happens:
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
40 <code>
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
41 original = dad.whatToDrag(draggable);
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
42 dragging = original.cloneNode(true);
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
43 original.parentNode.appendChild(dragging);
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
44 </code>
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
45 </p>
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
46
Franklin Schmidt <fschmidt@gmail.com>
parents: 4
diff changeset
47 <p>Most drag-and-drop tools drag the original by setting <b>position</b> to <b>relative</b> and moving it by setting <b>left</b> and <b>top</b>. But this breaks if the DOM is changed. So instead I clone the original and set <b>position</b> of the clone to <b>fixed</b>. This way, changing the DOM doesn't affect the location of what is being dragged.</p>
0
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
48 </body>
Franklin Schmidt <fschmidt@gmail.com>
parents:
diff changeset
49 </html>