mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
36 lines
1.0 KiB
HTML
36 lines
1.0 KiB
HTML
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Example</title>
|
|
|
|
<!-- Sets initial viewport load and disables zooming -->
|
|
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
<link rel="stylesheet" href="css/ionic.css">
|
|
<style>
|
|
#drag-me {
|
|
position: absolute;
|
|
width: 100px;
|
|
height: 100px;
|
|
background-color: red;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="content content-padded">
|
|
<div id="drag-me">Drag me around!</div>
|
|
</div>
|
|
<script src="../../js/framework/framework-utils.js"></script>
|
|
<script src="../../js/framework/framework-gestures.js"></script>
|
|
<script src="../../js/framework/framework-events.js"></script>
|
|
<script>
|
|
var db = document.getElementById('drag-me');
|
|
window.FM.onGesture('drag', function(e) {
|
|
console.log('Dragging', e);
|
|
var touch = e.gesture.touches[0];
|
|
db.style.left = touch.pageX-50;
|
|
db.style.top = touch.pageY-50;
|
|
}, db);
|
|
</script>
|
|
</body>
|
|
</html>
|