view src/examples/handle.html @ 6:4d699321068f

add dropzones
author Franklin Schmidt <fschmidt@gmail.com>
date Sun, 23 Apr 2023 18:34:12 -0600
parents 6d5e4b38b4fb
children 332d3e280f7e
line wrap: on
line source

<!doctype html>
<html>
	<head>
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<style>
			@import "/site.css";
			@import "/dad.css";

			span[handle] {
				display: inline-block;
				background-color: LightGreen;
				padding: 8px;
			}
			span[outer] {
				display: inline-block;
				background-color: LightBlue;
				padding: 8px;
			}
		</style>
		<script src="/dad.js"></script>
		<script>
			dad.whatToDrag = function(draggable) {
				return draggable.parentNode;
			};

			function init() {
				let span = document.querySelector('span[handle]');
				dad.setDraggable(span);
			}
		</script>
	</head>
	<body>
		<h1>Handle</h1>
		<p>
			<span outer>
				<span handle>drag me</span>
				along for the ride
			</span>
		</p>
		<p>bottom</p>
	</body>
	<script> init(); </script>
</html>