view src/examples/handle.html @ 10:ad2f6525c4c5

minor fix
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 11 May 2023 13:07:00 -0600
parents 332d3e280f7e
children
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";

			[handle] {
				display: inline-block;
				background-color: LightGreen;
				padding: 8px;
			}
			[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 handle = document.querySelector('[handle]');
				dad.setDraggable(handle);
			}
		</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>